📄 databaseconfirmpropertyfrm.pas
字号:
unit DatabaseConfirmPropertyFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, SJCustomProperty, cxLookAndFeelPainters, PropStorageEh,
StdCtrls, cxButtons, ExtCtrls, cxControls, cxContainer, cxEdit,
cxTextEdit, cxMaskEdit, cxButtonEdit;
type
TfrmPropertyDatabaseConfirm = class(TSJCustomPropertyForm)
Label1: TLabel;
edtDataPath: TcxButtonEdit;
Opendlg: TOpenDialog;
procedure edtDataPathPropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure btnOKClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmPropertyDatabaseConfirm: TfrmPropertyDatabaseConfirm;
implementation
uses SJInvPrintGlobal, MainFrm, Registry;
{$R *.dfm}
procedure TfrmPropertyDatabaseConfirm.edtDataPathPropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
// 查找系统数据源路径
begin
inherited;
if edtDataPath.Text <> '' then
Opendlg.InitialDir := edtDataPath.Text
else
Opendlg.InitialDir := ExtractFilePath(Application.ExeName) + 'Data\';
if Opendlg.Execute then
edtDataPath.Text := ExtractFilePath(Opendlg.FileName);
end;
procedure TfrmPropertyDatabaseConfirm.btnOKClick(Sender: TObject);
// 设置系统数据源路径
begin
inherited;
// 检查数据库文件是否有效
if Trim(edtDataPath.Text) = '' then
begin
ShowMessage('你没有设置系统数据库路径。');
edtDataPath.SetFocus;
Exit;
end;
// 写数据库文件路径到系统注册表项
with TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey(GREGsysPath, True) then
WriteString('Data Source', edtDataPath.Text + gSysDatafile);
GSysDataPath := edtDataPath.Text;
finally
Free;
end;
ModalResult := mrOk;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -