📄 rootform.pas
字号:
unit RootForm;
{
窗体名称:FormRoot.dfm
单元名称:FormRootP.Pas
模块说明:根窗体,系统中所有的窗子将从此窗体中继承。
附加说明:
作者:胡国荣
日期:2000-4-20
/============================以下是修改情况的记录=============================//
修改人:
修改原因:
修改时间:
/=======================================================================//
}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,grids,dbgrids,wwdbgrid,extctrls,DBGridEh;
type
TRootFrm = class(TForm)
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
RootFrm: TRootFrm;
const
EOL_RESOURCEDLL='eolres.dll';
BACK_IMAGE='back_image';
procedure GetImageFromDLL(DLLName:string;ResName:string;mImage:Timage);
implementation
{$R *.DFM}
//=========================================================================
//以下过程是处理回车键的问题;
//作者:吴新明
//时间:2000/04/22
//=========================================================================
procedure TRootFrm.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key <> #13 then Exit;
if not (ActiveControl is TCustomGrid) then
begin
Key := #0;
//移至下一控件
Perform ( WM_NEXTDLGCTL, 0, 0 );
end
else begin
//TDBGrid
if ( ActiveControl is TDBGridEh ) then
begin
//在DBGridEh的属性中已解决: OptionsEh.dghEnterAsTab:=True;
with TDBGridEh ( ActiveControl ) do
//未到最后一栏
if Selectedindex < ( FieldCount - 1 ) then
//条码
if CompareText(SelectedField.FieldName,'BarCode')=0 then
Selectedindex := Selectedindex + 4
else
if CompareText(SelectedField.FieldName,'ItemNo')=0 then
Selectedindex := Selectedindex + 5
else
Selectedindex := Selectedindex + 1
//在最后一栏
else begin
// SendMessage(TDBGrid(ActiveControl).Handle,WM_KEYDOWN, 9, 1);
//回到当前记录的第一栏
SelectedIndex := 0;
end;
end;
//TDBGrid
if ( ActiveControl is TDBGrid ) then
begin
with TDBGrid ( ActiveControl ) do
//未到最后一栏
if Selectedindex < ( FieldCount - 1 ) then
Selectedindex := Selectedindex + 1
//在最后一栏
else begin
// SendMessage(TDBGrid(ActiveControl).Handle,WM_KEYDOWN, 9, 1);
//回到当前记录的第一栏
SelectedIndex := 0;
end;
end;
//TwwDBGrid
if ( ActiveControl is TwwDBGrid ) then
begin
with TwwDBGrid ( ActiveControl ) do
//未到最后一栏
if Selectedindex < ( FieldCount - 1 ) then
Selectedindex := Selectedindex + 1
//在最后一栏
else begin
// SendMessage(TDBGrid(ActiveControl).Handle,WM_KEYDOWN, 9, 1);
//回到当前记录的第一栏
SelectedIndex := 0;
end;
end;
end;
end;
procedure TRootFrm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
// if (Key = VK_RETURN) and not (ActiveControl is TCustomGrid) then
// Key := VK_TAB;
end;
//===========================================================================
procedure TRootFrm.FormShow(Sender: TObject);
begin
//设置功能权限
// SetFuncRight(TForm(Sender));
end;
procedure GetImageFromDLL(DLLName:string;ResName:string;mImage:Timage);
var DLL_h:Thandle;
begin
DLL_h := LoadLibrary(PChar(DLLName));
if DLL_h < HINSTANCE_ERROR then begin
showmessage('丢失了资源文件');
exit;
end
else
mimage.Picture.Bitmap.LoadFromResourceName(DLL_h,ResName);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -