Delphi TStringStream 简单用法


本文整理自网络,侵删。

 
procedure TForm1.Button2Click(Sender: TObject);
var
  OutPutDemo: String;
  Buffer: TStringStream;
begin
  OutPutDemo :=   '@echo off ' +
  #13#10+'setlocal EnableDelayedExpansion ' +
  #13#10+'set "CSI=[" ' +
  #13#10+'echo/ ' +
  #13#10+'echo                     Ansi color table of console text colors ' +
  #13#10+'echo/ ' +
  #13#10+'echo                                        ^| -^> Foreground light colors ' +
  #13#10+'echo                                        ^| ' +
  #13#10+'for /L %%b in (40,1,47) do ( ' +
  #13#10+'   set "line=%CSI%%%b;30m%%b30" ' +
  #13#10+'   for /L %%f in (31,1,37) do set "line=!line!%CSI%%%b;%%fm %%b%%f" ' +
  #13#10+'   for /L %%f in (30,1,37) do set "line=!line!%CSI%%%b;%%f;1m %%b%%f" ' +
  #13#10+'   echo !line! ' +
  #13#10+') ' +
  #13#10+'echo/ ' +
  #13#10+'for /L %%b in (40,1,47) do ( ' +
  #13#10+'   set "line=%CSI%%%b;5;30m%%b30" ' +
  #13#10+'   for /L %%f in (31,1,37) do set "line=!line!%CSI%%%b;5;%%fm %%b%%f" ' +
  #13#10+'   for /L %%f in (30,1,37) do set "line=!line!%CSI%%%b;5;%%f;1m %%b%%f" ' +
  #13#10+'   echo !line! ' +
  #13#10+') ' +
  #13#10+'echo/ ' +
  #13#10+'pause ';

  if not FileExists(ExtractFilePath(ParamStr(0))+'colors.cmd') then
  begin
    Buffer := TStringStream.Create;
    try
      Buffer.WriteString(OutPutDemo);
      Buffer.SaveToFile(ExtractFilePath(ParamStr(0))+'colors.cmd');
    finally
      Buffer.Free;
    end;
  end;


  WinExec(PAnsiChar('cmd /c colors.cmd'), SW_SHOWNORMAL);
end;

相关阅读 >>

Delphi的tfilestream

Delphi线程中动态创建ado控件

Delphi incyear、incmonth、incweek、incday、inchour、incminute、incsecond、incmillisecond �c 增时

Delphi 极速字符串替换函数字符串转16进制

Delphi idhttp 获取链接连通状态

Delphi fdquery 判断记录为空

Delphi trim 删除字符串左右两边的空格

Delphi 解析系统环境变量

Delphi获取进程和模块信息

Delphi 代替pos的函数

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...