标签:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,IniFiles, Grids, ExtCtrls, Buttons; type TForm1 = class(TForm) btn1: TButton; btn2: TButton; bvl1: TBevel; strngrd: TStringGrid; btn3: TBitBtn; procedure btn1Click(Sender: TObject); procedure btn2Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure strngrdGetEditMask(Sender: TObject; ACol, ARow: Integer; var Value: String); procedure btn3Click(Sender: TObject); private { Private declarations } public { Public declarations } path:string; Function ReadOnePara(sIniFile,Sct,Idt:String):String; procedure WriteOnePara(sIniFile,Sct,Idt,Value:String); end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.btn1Click(Sender: TObject); begin WriteOnePara(path+‘基本配置.TAB‘,‘SHUTDOWN‘,‘chkHintMusic‘,‘ddalf‘); WriteOnePara(path+‘基本配置.TAB‘,‘关机时间‘,‘Music‘,‘1313‘); WriteOnePara(path+‘基本配置.TAB‘,‘桌面视频‘,‘chktMusic‘,‘fdasf455‘); WriteOnePara(path+‘基本配置.TAB‘,‘服务配置‘,‘chk‘,‘是真的吗‘); end; procedure TForm1.btn2Click(Sender: TObject); var s:string; begin s:=ReadOnePara(path+‘基本配置.TAB‘,‘SHUTDOWN‘,‘chkHintMusic‘); ShowMessage(s); s:=ReadOnePara(path+‘基本配置.TAB‘,‘关机时间‘,‘Music‘); ShowMessage(s); s:=ReadOnePara(path+‘基本配置.TAB‘,‘桌面视频‘,‘chktMusic‘); ShowMessage(s); s:=ReadOnePara(path+‘基本配置.TAB‘,‘服务配置‘,‘chk‘); ShowMessage(s); end; function TForm1.ReadOnePara(sIniFile, Sct, Idt: String): String; Var aIniFile:TIniFile; begin Result:=‘‘; aIniFile:=TIniFile.Create(sIniFile); try Result:=aIniFile.ReadString(Sct,Idt,‘‘); finally aIniFile.Free; end; end; procedure TForm1.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; procedure TForm1.FormCreate(Sender: TObject); begin Path:=ExtractFilePath(Application.ExeName); end; procedure TForm1.strngrdGetEditMask(Sender: TObject; ACol, ARow: Integer; var Value: String); begin Value:=‘00:00:00‘; end; procedure TForm1.btn3Click(Sender: TObject); begin strngrd.Cells[0,0]:=‘序号‘; strngrd.Cells[1,0]:=‘关机时间‘; strngrd.Cells[2,0]:=‘开机时间‘; strngrd.Cells[3,0]:=‘给‘; end; end.
标签:
原文地址:http://www.cnblogs.com/rogge7/p/4414430.html