SrmOption.~pa
上传用户:tj00001
上传日期:2007-01-07
资源大小:672k
文件大小:5k
源码类别:

行业应用

开发平台:

Delphi

  1. //---------------------------------------------------------------------------
  2. //(R)CopyRight KivenSoft International ,inc 1999
  3. //单元名称:选项对话框
  4. //程序名称:电子书库
  5. //作    者:李会文
  6. //开始时间:1998.07.28
  7. //最后修改:1999.07.15
  8. //备注:此单元定义了SRM文件的读写接口
  9. //---------------------------------------------------------------------------
  10. unit SrmOption;
  11. interface
  12. uses
  13.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  14.   ComCtrls, Buttons, StdCtrls, ExtCtrls, MainUnit, KvLabel;
  15. type
  16.   TOptionForm = class(TForm)
  17.     PageControl1: TPageControl;
  18.     TabSheet1: TTabSheet;
  19.     FileListCheckBox: TCheckBox;
  20.     MyLoveCheckBox: TCheckBox;
  21.     SaveCheckBox: TCheckBox;
  22.     DelCheckBox: TCheckBox;
  23.     Bevel1: TBevel;
  24.     Bevel2: TBevel;
  25.     Bevel3: TBevel;
  26.     MyLoveEdit: TEdit;
  27.     SpeedButton1: TSpeedButton;
  28.     SpeedButton2: TSpeedButton;
  29.     SpeedButton3: TSpeedButton;
  30.     Bevel4: TBevel;
  31.     TabSheet2: TTabSheet;
  32.     ReGroupBox: TGroupBox;
  33.     KvLabel3: TKvLabel;
  34.     KvLabel4: TKvLabel;
  35.     KvLabel5: TKvLabel;
  36.     KvLabel6: TKvLabel;
  37.     SrmCheckBox: TCheckBox;
  38.     LoadSrmCheckBox: TCheckBox;
  39.     KvLabel2: TKvLabel;
  40.     KvLabel1: TKvLabel;
  41.     SpeedButton4: TSpeedButton;
  42.     KvLabel7: TKvLabel;
  43.     TvGroupBox: TGroupBox;
  44.     TvPanel: TPanel;
  45.     RePanel: TPanel;
  46.     TvShape: TShape;
  47.     TvLabel: TKvLabel;
  48.     ReShape: TShape;
  49.     ReLabel: TKvLabel;
  50.     procedure FormKeyPress(Sender: TObject; var Key: Char);
  51.     procedure SpeedButton2Click(Sender: TObject);
  52.     procedure SpeedButton3Click(Sender: TObject);
  53.     procedure SpeedButton1Click(Sender: TObject);
  54.     procedure FormCreate(Sender: TObject);
  55.     procedure SpeedButton4Click(Sender: TObject);
  56.     procedure TvShapeMouseDown(Sender: TObject; Button: TMouseButton;
  57.       Shift: TShiftState; X, Y: Integer);
  58.     procedure TvLabelClick(Sender: TObject);
  59.   private
  60.     { Private declarations }
  61.   public
  62.     { Public declarations }
  63.   end;
  64. var
  65.   OptionForm: TOptionForm;
  66. implementation
  67. uses SrmConst, RegUnit;
  68. {$R *.DFM}
  69. procedure TOptionForm.FormCreate(Sender: TObject);
  70. begin
  71.   SpeedButton2.Glyph.LoadFromResourceName(HInstance,'CANCELBMP');
  72.   SpeedButton3.Glyph.LoadFromResourceName(HInstance,'OKBMP');
  73.   SpeedButton4.Glyph.LoadFromResourceName(HInstance,'RESETBMP');
  74.   with AppIni,SrmForm do
  75.   begin
  76.     SrmCheckBox.Checked:=OpenSrmWithApp;
  77.     LoadSrmCheckBox.Checked:=LoadNearFile;
  78.     FileListCheckBox.Checked:=FileListVisible;
  79.     MyLoveCheckBox.Checked:=MyLoveVisible;
  80.     SaveCheckBox.Checked:=SaveDbQuery;
  81.     DelCheckBox.Checked:=DelRecordQuery;
  82.     MyLoveEdit.Text:=MyLoveFile;
  83.     TvShape.Brush.Color:=TreeView.Color;
  84.     ReShape.Brush.Color:=RichEdit.Color;
  85.     TvLabel.Font:=TreeView.Font;
  86.     ReLabel.Font:=RichEdit.Font;
  87.   end;
  88.   TvLabel.Left:=(TvLabel.Parent.Width-TvLabel.Width) div 2;  //设置Label到中心
  89.   TvLabel.Top:=(TvLabel.Parent.Height-TvLabel.Height) div 2;
  90.   ReLabel.Left:=(ReLabel.Parent.Width-ReLabel.Width) div 2;
  91.   ReLabel.Top:=(ReLabel.Parent.Height-ReLabel.Height) div 2;
  92. end;
  93. procedure TOptionForm.FormKeyPress(Sender: TObject; var Key: Char);
  94. begin
  95.   if Key=#13 then SpeedButton3Click(self);
  96.   if Key=#27 then SpeedButton2Click(self);
  97. end;
  98. procedure TOptionForm.SpeedButton2Click(Sender: TObject);
  99. begin
  100.   ModalResult:=MrCancel;
  101. end;
  102. procedure TOptionForm.SpeedButton3Click(Sender: TObject);
  103. begin
  104.   ModalResult:=MrOk;
  105. end;
  106. procedure TOptionForm.SpeedButton1Click(Sender: TObject);
  107. begin
  108.   with TOpenDialog.Create(self) do
  109.   begin
  110.     DefaultExt:=csSrmExt;
  111.     Filter:=csSrmFilter;
  112.     Title:=csOpenTitle;
  113.     if Execute then
  114.     begin
  115.       MyLoveEdit.Text:=FileName;
  116.     end;
  117.     Free;
  118.   end;
  119. end;
  120. procedure TOptionForm.SpeedButton4Click(Sender: TObject);
  121. begin
  122.   SrmCheckBox.Checked:=true;
  123.   LoadSrmCheckBox.Checked:=true;
  124.   FileListCheckBox.Checked:=true;
  125.   MyLoveCheckBox.Checked:=true;
  126.   SaveCheckBox.Checked:=true;
  127.   DelCheckBox.Checked:=true;
  128.   TvShape.Brush.Color:=clWindow;
  129.   ReShape.Brush.Color:=clWindow;
  130.   with TvLabel.Font do
  131.   begin
  132.     Name:='system';
  133.     Size:=9;
  134.     Color:=clWindowText;
  135.     Style:=[];
  136.   end;
  137.   with ReLabel.Font do
  138.   begin
  139.     Name:='system';
  140.     Size:=9;
  141.     Color:=clWindowText;
  142.     Style:=[];
  143.   end;
  144. end;
  145. procedure TOptionForm.TvShapeMouseDown(Sender: TObject;
  146.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  147. begin
  148.   with TColorDialog.Create(self) do
  149.   begin
  150.     if Sender=TvShape then Color:=SrmForm.TreeView.Color
  151.     else Color:=SrmForm.RichEdit.Color;
  152.     if Execute then TShape(Sender).Brush.Color:=Color;
  153.     Free;
  154.   end;
  155. end;
  156. procedure TOptionForm.TvLabelClick(Sender: TObject);
  157. begin
  158.   with TFontDialog.Create(self) do
  159.   begin
  160.     if Sender=TvLabel then Font:=SrmForm.TreeView.Font
  161.     else Font:=SrmForm.RichEdit.Font;
  162.     if Execute then
  163.     begin
  164.       TKvLabel(Sender).Font:=Font;
  165.       TKvLabel(Sender).Left:=(TKvLabel(Sender).Parent.Width-TKvLabel(Sender).Width) div 2;
  166.       TKvLabel(Sender).Top:=(TKvLabel(Sender).Parent.Height-TKvLabel(Sender).Height) div 2;
  167.     end;
  168.     Free;
  169.   end;
  170. end;
  171. end.