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 下载并运行的代码

Delphi将目录删除到回收站中

Delphi spcomm串口控件的例程

Delphi listbox模糊查找文字

Delphi在网格cxgrid的左上角放置一个按钮

Delphi 比较版本号

Delphi system.sysutils.tmarshaller 与 system.tmarshal

Delphi getsessionusername通过会话id得到会话名称

Delphi tmsweb core 刷新当前页面

Delphi for android 获取手机号

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



打赏

取消

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

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

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

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

评论

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