打开一个配置文件:

打开一个配置文件

操作TStringGrid

 Procedure EmptyGrid(Var sg:TStringGrid);
Var i:Integer;
begin
for i:= to sg.RowCount - do
sg.Rows[i].clear;
sg.RowCount :=;
end; Procedure SetGridTitle(Var SG:TStringGrid; sTil:array of String);
Var i,l,h:integer;
begin
l:=Low(sTil);
h:=High(sTil);
if sg.ColCount<h-l+ then sg.ColCount:=h-l+;
for i:= to sg.ColCount - do
begin
sg.Cells[i,]:=sTil[l+i];
if i>h then Exit;
end;
end; Procedure SetGridNumber(Var SG:TStringGrid;
Col,bn,len:Integer;ch:Char);
Var i:integer;
begin
for i:= to sg.RowCount - do
begin
sg.Cells[Col,i]:=Format('%d',[bn+i-]);
sg.Cells[Col,i]:=Padl(sg.Cells[Col,i],ch,len);
end;
end;

操作TStringGrid

 procedure TFrmPara.WriteParameters;
Var s:String;
begin
DelOneDevice(MYINI,'关机时间');
WriteGridToINI(MYINI,'关机时间',sgTime);
DelOneDevice(MYINI,'桌面图片');
WriteGridToINI(MYINI,'桌面图片',sgPic);
DelOneDevice(MYINI,'背景音乐');
WriteGridToINI(MYINI,'背景音乐',sgSong);
DelOneDevice(MYINI,'桌面提示');
WriteGridToINI(MYINI,'桌面提示',sgHint);
DelOneDevice(MYINI,'定时提示');
WriteGridToINI(MYINI,'定时提示',sgNote); WriteOnePara(MYINI,'SHUTDOWN','chkSrvShutDown',BoolStr(chkSrvShutDown.checked));
WriteOnePara(MYINI,'SHUTDOWN','chkShutAfterATime',BoolStr(chkShutAfterATime.checked));
WriteOnePara(MYINI,'SHUTDOWN','Interval',inttostr(spInterval.value)); WriteOnePara(MYINI,'SHUTDOWN','chkClose',BoolStr(chkClose.checked));
WriteOnePara(MYINI,'SHUTDOWN','spClose',inttostr(spClose.value)); WriteOnePara(MYINI,'SHUTDOWN','AutoShutDown',BoolStr(chkAutoShutDown.checked));
WriteOnePara(MYINI,'SHUTDOWN','chkShowDate',BoolStr(chkShowDate.checked));
WriteOnePara(MYINI,'SHUTDOWN','chkPlayMusic',BoolStr(chkPlayMusic.checked));
WriteOnePara(MYINI,'SHUTDOWN','chkStopMusic',BoolStr(chkStopMusic.checked)); WriteOnePara(MYINI,'SHUTDOWN','tbVol1',inttostr(tbVol1.Position));
WriteOnePara(MYINI,'SHUTDOWN','tbVol2',inttostr(tbVol2.Position)); WriteOnePara(MYINI,'SHUTDOWN','chkShowLine',BoolStr(chkShowLine.checked));
WriteOnepara(MYINI,'SHUTDOWN','Font',fonttostring(plHintFont.Font,True));
MyWriteColor(MYINI,'SHUTDOWN','FrameColor',plLineColor.font.Color); WriteOnePara(MYINI,'SHUTDOWN','chkClockOne',BoolStr(chkClockOne.checked));
WriteOnePara(MYINI,'SHUTDOWN','chkClockHalf',BoolStr(chkClockHalf.checked));
WriteOnePara(MYINI,'SHUTDOWN','chkHintWindow',BoolStr(chkHintWindow.checked));
WriteOnePara(MYINI,'SHUTDOWN','chkWallPaper',BoolStr(chkWallPaper.checked));
WriteOnePara(MYINI,'SHUTDOWN','chkHintMusic',BoolStr(chkHintMusic.checked));
WriteOnePara(MYINI,'SHUTDOWN','chkHintMusicFade',BoolStr(chkHintMusicFade.checked));
WriteOnePara(MYINI,'SHUTDOWN','spHintMusicFade',inttostr(spHintMusicFade.value)); MyWriteColor(MYINI,'SHUTDOWN','BKCOLOR',MyBackColor);
WriteOnePara(MYINI,'SHUTDOWN','chkMusicDown',BoolStr(chkMusicDown.checked));
WriteOnePara(MYINI,'SHUTDOWN','chkMusicStopRun',BoolStr(chkMusicStopRun.checked));
WriteOnePara(MYINI,'SHUTDOWN','chkMusicStopPlay',BoolStr(chkMusicStopPlay.checked));
WriteOnePara(MYINI,'SHUTDOWN','chkMusicFade',BoolStr(chkMusicFade.checked));
WriteOnePara(MYINI,'SHUTDOWN','spMusicDown',inttostr(spMusicDown.value));
WriteOnePara(MYINI,'SHUTDOWN','spMusicStopRun',inttostr(spMusicStopRun.value));
WriteOnePara(MYINI,'SHUTDOWN','spMusicStopPlay',inttostr(spMusicStopPlay.value));
WriteOnePara(MYINI,'SHUTDOWN','spMusicFade',inttostr(spMusicFade.value)); end; procedure DelOneDevice(devFile:String;sType:String);
Var aIniFile:TIniFile;
begin
aIniFile:=TIniFile.Create(devFile);
try
aIniFile.EraseSection(sType);
finally
aIniFile.Free;
end;
end; procedure WriteGridToINI(sFile,Sect:String;sg:TStringGrid);
Var i:integer;
s:String;
begin
{$I-}
DelOneDevice(sFile,Sect);
for i:= to SG.RowCount- do
begin
StrgridToStr(S,SG,i);
WriteOnePara(sFile,Sect,'Row'+IntToStr(i),s);
end;
end; procedure StrGridToStr(Var S:String; Var SG:TStringGrid; Row:longint);
Var i:integer;
begin
S:='';
for i:= to SG.ColCount - do
S:=S+SG.Cells[i,Row]+'^^';
end; procedure WriteOnePara(sIniFile,Sct,Idt,Value:String);
Var aIniFile:TIniFile;
begin
aIniFile:=TIniFile.Create(sIniFile);
try
aIniFile.WriteString(Sct,Idt,Value);
finally
aIniFile.Free;
end;
end;

《用delphi开发共享软件》-15.2桌面提示器的更多相关文章

  1. 启动windows的服务--《用delphi开发共享软件》-15.2桌面提示器

    在dos 下用命令启动一个服务:NET START "Windows Desktop Reminder" 一下为用delphi启动服务: Function RunProcess(s ...

  2. 字体和壁纸合并后再更改壁纸--《用delphi开发共享软件》-15.2桌面提示器

    procedure TFrmPlay.mnDeskPicClick(Sender: TObject); Var s:String; i:Integer; begin //s:=Path+'SetPic ...

  3. 软件打开时间、窗体透明度、背景色---《用delphi开发共享软件》-15.1任务管理器

    1.计算软件启动了多长时间:用定时器,每分钟触发一次: procedure TFrmMain.tmCheckLegalTimer(Sender: TObject);Var Minutes:LongIn ...

  4. 设置随机启动--《用delphi开发共享软件》-15.1任务管理器

    在设置窗体中 chkAutoStart: TCheckBox; 在设置窗体中 chkAutoStart: TCheckBox; procedure TFrmSetup.FormCreate(Sende ...

  5. 实现窗体随着鼠标移动(控件)--《用delphi开发共享软件》-15.1任务管理器

    private //窗体移动: OldPos,NewPos:TPoint; bMove:Boolean; procedure TForm1.FormMouseDown(Sender: TObject; ...

  6. DELPHI开发LINUX桌面程序

    DELPHI开发LINUX桌面程序 DELPHI官方目前为止尚不能开发LINUX桌面程序. 但三方控件FmxLinux(商业控件)是可以的.网上有破解版本.

  7. (转载)Delphi开发经验谈

    Delphi开发经验谈 开发环境-------- Delphi 7是一个很经典的版本,在Win2000/XP下推荐安装Delphi 7来开发软件,在Vista下推荐使用Delphi 2007开发软件. ...

  8. Windows Phone 8初学者开发—第15部分:在选中ListItem时播放声音

    原文 Windows Phone 8初学者开发—第15部分:在选中ListItem时播放声音 第15部分:在选中ListItem时播放声音 原文地址:  http://channel9.msdn.co ...

  9. Ubuntu 中用 delphi 开发 apache

    经过近15年的沉默.delphi 10.2 终于重新开始支持linux 开发了. 今天说一下在ubuntu中开发apache的方法. 首先安装ubuntu 的delphi 开发环境,请参考以前的文章 ...

随机推荐

  1. 【linux】sudo su切换到root权限

    在用户有sudo权限但不知道root密码时可用 sudo su切换到root用户

  2. 关于Windows下的文件后缀名问题

    一.背景说明 有很多的小伙伴对windows下的文件后缀名不能很好地理解作用和区别,更不用说高深的使用了,在这里给大家说一下这些文件后缀名到底有什么区别,有什么作用呢? 二.说明 简单的说来,wind ...

  3. September 8th 2016 Week 37th Thursday

    The secret of high-impact business is early preparation. 高效商务,赢在未雨绸缪. Early and best preparation is ...

  4. NYOJ题目1162数字

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAr8AAAJ/CAIAAAD+kywNAAAgAElEQVR4nO3dO1LjzN4H4G8T5CyE2A ...

  5. RST_n的问题

     有一个灰常郁闷的问题... module CLK_Generater(                    input        CLOCK_100,                    i ...

  6. PHP中 字符串 常用函数

    //strpos    查找字符串中是否含有字符 $str='abcde'; $char='a':   if(strpos($str,$char) !==false){    echo '含有',$c ...

  7. python 中time模块使用

    在开始之前,首先要说明这几点: 1.在Python中,通常有这几种方式来表示时间:1)时间戳 2)格式化的时间字符串 3)元组(struct_time)共九个元素.由于Python的time模块实现主 ...

  8. DOM – 7.动态创建DOM + 8.innerText innerHTML value

    7.动态创建DOM 8.innerText  innerHTML  value 7+8 练习:案例:点击按钮动态增加网站列表,分两列,第一列为网站的名字,第二列为带网站超链接的网站名.增加三行常见网站 ...

  9. 设计模式学习之中介者模式(Mediator,行为型模式)(18)

    转载地址:http://www.cnblogs.com/zhili/p/MediatorPattern.html 一.引言 在现实生活中,有很多中介者模式的身影,例如QQ游戏平台,聊天室.QQ群和短信 ...

  10. Bootstrap简介

    接下来的一段时间,想研究一下现有的网页框架,第一个不容错过的就是Bootstrap,Bootstrap 是一个用于快速开发 Web 应用程序和网站的前端框架.Bootstrap 是基于 HTML.CS ...