pubunit.pas

来自「导出ORACLE 8/9系列的表空间结构并打印」· PAS 代码 · 共 99 行

PAS
99
字号
unit PubUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls, ExtCtrls, Registry, ADODB, SUIForm, SUIDBCtrls,
  SUIThemes, SUIButton, SUIDlg, TypInfo, IniFiles, DB;

var
  Pub_TableSpace : String ;
  SysPath : String;
  OraVer,ServerName,DBName,UserName,Password : String;
  LoginModalResult : Integer ;
  P_Interface : integer ;//界面处理
  //以下函数可以找到一个控件是否有某个属性
  function  FindProperty(AClass:  TObject;  sPropertyName:  String):  Boolean;
  //======改变窗口的显示风格
  Procedure ChangeInterface(MyForm : TForm; MysuiForm : TSuiForm);
  //读取INI文件
  procedure ReadIni ;
  //写INI文件
  procedure WriteIni ;

implementation

  //以下函数可以找到一个控件是否有某个属性
  function  FindProperty(AClass:  TObject;  sPropertyName:  String):  Boolean;
  var
    PropList:  PPropList;
    ClassTypeInfo:  PTypeInfo;
    ClassTypeData:  PTypeData;
    i:  integer;
  begin
    Result := False;
    ClassTypeInfo := aClass.ClassType.ClassInfo;
    ClassTypeData := GetTypeData(ClassTypeInfo);
    if ClassTypeData.PropCount <> 0 then
    begin
      GetMem(PropList,SizeOf(PPropInfo)*ClassTypeData.PropCount);
      try
        GetPropInfos(AClass.ClassInfo,PropList);
        for  i := 0 to ClassTypeData.PropCount - 1  do
          if (PropList[i]^.PropType^.Kind <> tkMethod)
              and (UpperCase(PropList[i]^.Name) = UpperCase(sPropertyName)) then
          begin
            Result  :=  True;
            Break;
          end;
      finally
        FreeMem(PropList,  SizeOf(PPropInfo)  *  ClassTypeData.PropCount);
      end;
    end;
  end;

  //======改变窗口的显示风格
  Procedure ChangeInterface(MyForm : TForm; MysuiForm : TSuiForm);
  var i,Count : integer ;
  begin
    MysuiForm.UIStyleAutoUpdateSub := false ;
    case P_Interface of
      Ord(BlueGlass)  : MysuiForm.UIStyle := BlueGlass ;
      Ord(DeepBlue)   : MysuiForm.UIStyle := DeepBlue ;
      Ord(Protein)    : MysuiForm.UIStyle := Protein ;
      Ord(MacOS)      : MysuiForm.UIStyle := MacOS ;
      Ord(WinXP)      : MysuiForm.UIStyle := WinXP ;
    end;
    Count := MyForm.ComponentCount ;
    for i := 0 to Count - 1 do
    begin
      if FindProperty(MyForm.Components[i],'UIStyle') then
         SetPropValue(MyForm.Components[i],'UIStyle',MysuiForm.UIStyle);
    end;
    MysuiForm.Update ;
    MysuiForm.Refresh ;
    MyForm.Refresh ;
  end;

  //读取INI文件
  procedure ReadIni ;
  var IniFile : TIniFile ;
      tmpDate,OldDate : String ;
  begin
    IniFile := TIniFile.Create(SysPath+'\System.ini');
    P_InterFace := IniFile.ReadInteger('Interface','Interface',Ord(WinXP));
    IniFile.Free ;
  end;

  //写INI文件
  procedure WriteIni ;
  var IniFile : TIniFile ;
  begin
    IniFile := TIniFile.Create(SysPath+'\System.ini');
    IniFile.WriteInteger('Interface','Interface',P_InterFace);
    IniFile.Free ;
  end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?