zoukankan      html  css  js  c++  java
  • 《用delphi开发共享软件》-15.2桌面提示器

    打开一个配置文件:

    打开一个配置文件

    操作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 begin
    12 l:=Low(sTil);
    13 h:=High(sTil);
    14 if sg.ColCount<h-l+1 then sg.ColCount:=h-l+1; 
    15 for i:=0 to sg.ColCount -1 do
    16 begin
    17 sg.Cells[i,0]:=sTil[l+i];
    18 if i>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 begin
    26 for i:=1 to sg.RowCount -1 do
    27 begin
    28 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 begin
    57 aIniFile:=TIniFile.Create(devFile);
    58 try
    59 aIniFile.EraseSection(sType);
    60 finally
    61 aIniFile.Free;
    62 end;
    63 end;
    64 
    65 procedure WriteGridToINI(sFile,Sect:String;sg:TStringGrid);
    66 Var i:integer;
    67 s:String;
    68 begin
    69 {$I-}
    70 DelOneDevice(sFile,Sect);
    71 for i:=0 to SG.RowCount-1 do
    72 begin
    73 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 begin
    81 S:='';
    82 for i:=0 to SG.ColCount -1 do
    83 S:=S+SG.Cells[i,Row]+'^^';
    84 end;
    85 
    86 procedure WriteOnePara(sIniFile,Sct,Idt,Value:String);
    87 Var aIniFile:TIniFile;
    88 begin
    89 aIniFile:=TIniFile.Create(sIniFile);
    90 try
    91 aIniFile.WriteString(Sct,Idt,Value);
    92 finally
    93 aIniFile.Free;
    94 end;
    95 end;
    View Code
  • 相关阅读:
    encodeURI() 的用法
    $().each() 与 $.each()区别,以及 jquery ajax 应用
    每日一乐,健康多滋味~~
    IIS部署ASP.NET MVC (4.0)网站出现的错误
    《程序员级别鉴定书》 ----中级.NET开发者
    《转》程序员必须知道的10大基础实用算法及其讲解
    C# 托管资源和非托管资源
    11、E-commerce in Your Inbox:Product Recommendations at Scale-----产品推荐(prod2vec和user2vec)
    二叉树(2)----路径
    10、Latent Relational Metric Learning via Memory-based Attention for Collaborative Ranking-----基于记忆注意的潜在关系度量协同排序
  • 原文地址:https://www.cnblogs.com/rogge7/p/4459789.html
Copyright © 2011-2022 走看看