?? basemdi.pas
字號:
unit BaseMdi;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, jpeg, Grids, DBGridEh, BaseDBGridEh,
Base;
type
TBaseMdiForm = class(TBaseDBGridEhForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
private
procedure SetDBGridEhTitleAlignment;
{ Private declarations }
protected
procedure WMSize(var Message: TWMSize); message WM_SIZE;
public
//覆蓋Create方法
constructor Create(AOwner: TComponent);reintroduce;override; //所有MDI子窗體從此基類繼承就不會有閃動了
{ Public declarations }
end;
var
BaseMdiForm: TBaseMdiForm;
implementation
uses SysPublic, DataM, Main;
{$R *.dfm}
procedure TBaseMdiForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
Self:= Nil;
end;
procedure TBaseMdiForm.SetDBGridEhTitleAlignment;
var
i, j: integer;
begin
for i :=0 to ComponentCount-1 do
begin
if Components[i] is TDBGridEh then
begin
for j :=0 to (Components[i] as TDBGridEh).Columns.Count-1 do
begin
(Components[i] as TDBGridEh).Columns[j].Title.Alignment:= taCenter;
// (Components[i] as TDBGridEh).Columns[j].Title.Font.Style := [fsBold];
end;
end;
end;
end;
procedure TBaseMdiForm.FormShow(Sender: TObject);
begin
inherited;
/// SetDBGridEhTitleAlignment;
end;
procedure TBaseMdiForm.WMSize(var Message: TWMSize);
begin
inherited;
if Message.SizeType = SIZEFULLSCREEN then
begin
if not SElf.Active then
Self.WindowState := wsNormal;
end;
end;
constructor TBaseMdiForm.Create(AOwner: TComponent);
begin
//MDIMainForm為 [MDI主窗體] ,如果不想引用,可以用全局變量保存
LockWindowUpdate(MainForm.Handle); //鎖定MDI主窗口,禁止刷新
try
inherited; //子窗體的動畫會在inherited時發生
finally
LockWindowUpdate(0); //解鎖
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -