博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
《用delphi开发共享软件》-15.2桌面提示器
阅读量:6843 次
发布时间:2019-06-26

本文共 4289 字,大约阅读时间需要 14 分钟。

打开一个配置文件:

打开一个配置文件

操作TStringGrid

1 Procedure EmptyGrid(Var sg:TStringGrid); 2 Var i:Integer; 3 begin 4 for i:=1 to sg.RowCount -1 do 5 sg.Rows[i].clear; 6 sg.RowCount :=2; 7 end; 8  9 Procedure SetGridTitle(Var SG:TStringGrid; sTil:array of String);10 Var i,l,h:integer;11 begin12 l:=Low(sTil);13 h:=High(sTil);14 if sg.ColCount
h then Exit;19 end;20 end;21 22 Procedure SetGridNumber(Var SG:TStringGrid;23 Col,bn,len:Integer;ch:Char);24 Var i:integer;25 begin26 for i:=1 to sg.RowCount -1 do27 begin28 sg.Cells[Col,i]:=Format('%d',[bn+i-1]);29 sg.Cells[Col,i]:=Padl(sg.Cells[Col,i],ch,len);30 end;31 end;
操作TStringGrid

 

1 procedure TFrmPara.WriteParameters; 2 Var s:String; 3 begin 4 DelOneDevice(MYINI,'关机时间'); 5 WriteGridToINI(MYINI,'关机时间',sgTime); 6 DelOneDevice(MYINI,'桌面图片'); 7 WriteGridToINI(MYINI,'桌面图片',sgPic); 8 DelOneDevice(MYINI,'背景音乐'); 9 WriteGridToINI(MYINI,'背景音乐',sgSong);10 DelOneDevice(MYINI,'桌面提示');11 WriteGridToINI(MYINI,'桌面提示',sgHint);12 DelOneDevice(MYINI,'定时提示');13 WriteGridToINI(MYINI,'定时提示',sgNote);14 15 WriteOnePara(MYINI,'SHUTDOWN','chkSrvShutDown',BoolStr(chkSrvShutDown.checked));16 WriteOnePara(MYINI,'SHUTDOWN','chkShutAfterATime',BoolStr(chkShutAfterATime.checked));17 WriteOnePara(MYINI,'SHUTDOWN','Interval',inttostr(spInterval.value));18 19 WriteOnePara(MYINI,'SHUTDOWN','chkClose',BoolStr(chkClose.checked));20 WriteOnePara(MYINI,'SHUTDOWN','spClose',inttostr(spClose.value));21 22 WriteOnePara(MYINI,'SHUTDOWN','AutoShutDown',BoolStr(chkAutoShutDown.checked));23 WriteOnePara(MYINI,'SHUTDOWN','chkShowDate',BoolStr(chkShowDate.checked));24 WriteOnePara(MYINI,'SHUTDOWN','chkPlayMusic',BoolStr(chkPlayMusic.checked));25 WriteOnePara(MYINI,'SHUTDOWN','chkStopMusic',BoolStr(chkStopMusic.checked));26 27 WriteOnePara(MYINI,'SHUTDOWN','tbVol1',inttostr(tbVol1.Position));28 WriteOnePara(MYINI,'SHUTDOWN','tbVol2',inttostr(tbVol2.Position));29 30 WriteOnePara(MYINI,'SHUTDOWN','chkShowLine',BoolStr(chkShowLine.checked));31 WriteOnepara(MYINI,'SHUTDOWN','Font',fonttostring(plHintFont.Font,True));32 MyWriteColor(MYINI,'SHUTDOWN','FrameColor',plLineColor.font.Color);33 34 WriteOnePara(MYINI,'SHUTDOWN','chkClockOne',BoolStr(chkClockOne.checked));35 WriteOnePara(MYINI,'SHUTDOWN','chkClockHalf',BoolStr(chkClockHalf.checked));36 WriteOnePara(MYINI,'SHUTDOWN','chkHintWindow',BoolStr(chkHintWindow.checked));37 WriteOnePara(MYINI,'SHUTDOWN','chkWallPaper',BoolStr(chkWallPaper.checked));38 WriteOnePara(MYINI,'SHUTDOWN','chkHintMusic',BoolStr(chkHintMusic.checked));39 WriteOnePara(MYINI,'SHUTDOWN','chkHintMusicFade',BoolStr(chkHintMusicFade.checked));40 WriteOnePara(MYINI,'SHUTDOWN','spHintMusicFade',inttostr(spHintMusicFade.value));41 42 MyWriteColor(MYINI,'SHUTDOWN','BKCOLOR',MyBackColor);43 WriteOnePara(MYINI,'SHUTDOWN','chkMusicDown',BoolStr(chkMusicDown.checked));44 WriteOnePara(MYINI,'SHUTDOWN','chkMusicStopRun',BoolStr(chkMusicStopRun.checked));45 WriteOnePara(MYINI,'SHUTDOWN','chkMusicStopPlay',BoolStr(chkMusicStopPlay.checked));46 WriteOnePara(MYINI,'SHUTDOWN','chkMusicFade',BoolStr(chkMusicFade.checked));47 WriteOnePara(MYINI,'SHUTDOWN','spMusicDown',inttostr(spMusicDown.value));48 WriteOnePara(MYINI,'SHUTDOWN','spMusicStopRun',inttostr(spMusicStopRun.value));49 WriteOnePara(MYINI,'SHUTDOWN','spMusicStopPlay',inttostr(spMusicStopPlay.value));50 WriteOnePara(MYINI,'SHUTDOWN','spMusicFade',inttostr(spMusicFade.value));51 52 end;53 54 procedure DelOneDevice(devFile:String;sType:String);55 Var aIniFile:TIniFile;56 begin57 aIniFile:=TIniFile.Create(devFile);58 try59 aIniFile.EraseSection(sType);60 finally61 aIniFile.Free;62 end;63 end;64 65 procedure WriteGridToINI(sFile,Sect:String;sg:TStringGrid);66 Var i:integer;67 s:String;68 begin69 {
$I-}70 DelOneDevice(sFile,Sect);71 for i:=0 to SG.RowCount-1 do72 begin73 StrgridToStr(S,SG,i);74 WriteOnePara(sFile,Sect,'Row'+IntToStr(i),s);75 end;76 end;77 78 procedure StrGridToStr(Var S:String; Var SG:TStringGrid; Row:longint);79 Var i:integer;80 begin81 S:='';82 for i:=0 to SG.ColCount -1 do83 S:=S+SG.Cells[i,Row]+'^^';84 end;85 86 procedure WriteOnePara(sIniFile,Sct,Idt,Value:String);87 Var aIniFile:TIniFile;88 begin89 aIniFile:=TIniFile.Create(sIniFile);90 try91 aIniFile.WriteString(Sct,Idt,Value);92 finally93 aIniFile.Free;94 end;95 end;
View Code

 

转载地址:http://iobul.baihongyu.com/

你可能感兴趣的文章
韩忠恒:解读Power System智慧运算基础
查看>>
来自Reddit的声音:网络人员对SDN说“不”
查看>>
贵阳“小步快跑”搭上云计算的早班车
查看>>
配置少量固态硬盘即能大幅提升性能
查看>>
国内车载信息安全市场 东软靠技术创新的行动力独树一帜
查看>>
中国银行携手IBM成功建成智能化网点
查看>>
再谈大型数据中心的运维工作
查看>>
报告显示电话监控技术处于发展浪潮
查看>>
安全研究人员发现可以利用推特控制僵尸网络
查看>>
三种在Linux上创建或扩展交换分区的简单方法
查看>>
LMD Tool:Linux恶意软件检测工具
查看>>
铜缆宽带接入即将走向末路?
查看>>
哪些技术对5G贡献最大?毫米波成工程师追捧之一
查看>>
企业级SaaS服务的现实之路:放弃团队 直指公司
查看>>
你应该成为 Web 开发者的 5 大理由
查看>>
Locky勒索软件是如何利用DGA的?
查看>>
打造自己的 Python 编码环境
查看>>
使用Azure托管磁盘简化云存储管理
查看>>
你需要知道知道这几个因素会不利于关键词排名优化
查看>>
《Cocos2D权威指南》——1.5 在设备上运行HelloCocos2D项目
查看>>