像Word那样,每个子窗体都是最大化的,已经创建的子窗体不再创建,而是把它放到前面
我用的方法
主窗体代码:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, Menus, WinSkinData;type
TMainForm = class(TForm)
SkinData1: TSkinData;
ToolBar1: TToolBar;
ToolButton2: TToolButton;
ToolButton1: TToolButton;
ToolButton3: TToolButton;
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
MainForm: TMainForm;implementation{$R *.dfm}
uses Unit2, Unit3;
procedure TMainForm.ToolButton1Click(Sender: TObject);
begin
if not assigned(InputForm) then
begin
InputForm:=TInputForm.Create(self);
InputForm.Show;
end else
InputForm.Width:=MainForm.ClientWidth;
InputForm.Height:=MainForm.ClientHeight;
InputForm.Top:=0;
InputForm.Left:=0;
InputForm.WindowState:=wsMaximized;
InputForm.BringToFront;
end;procedure TMainForm.ToolButton2Click(Sender: TObject);
begin
if not assigned(ViewForm) then
begin
ViewForm:=TViewForm.Create(self);
VIewForm.Show;
end else
ViewForm.Width:=MainForm.ClientWidth;
ViewForm.Height:=MainForm.ClientHeight;
ViewForm.Top:=0;
ViewForm.Left:=0;
ViewForm.WindowState:=wsMaximized;
ViewForm.BringToFront;
end;end.
子窗体代码:
unit Unit2;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ToolWin, ComCtrls, Buttons;type
TInputForm = class(TForm)
RichEdit1: TRichEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
Edit1: TEdit;
Label1: TLabel;
BitBtn5: TBitBtn;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure CreateParams(var Params: TCreateParams); override;
private
{ Private declarations }
public
{ Public declarations }
end;var
InputForm: TInputForm;implementation{$R *.dfm}Procedure TInputForm.CreateParams( var Params : tCreateParams );
Begin
Inherited CreateParams( Params );
Params.Style := Params.Style and (not WS_CAPTION);
End;procedure TInputForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Self:=nil;
Action:=caFree;
end;end.只有这样才能隐藏掉该死的标题栏,但是问题是切换时总有闪烁一下标题栏还有一个问题,我用了vclskin后,如果主窗体有菜单的话,菜单旁边总是有子窗体的三个按钮,怎么去掉?谢谢!
我用的方法
主窗体代码:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, Menus, WinSkinData;type
TMainForm = class(TForm)
SkinData1: TSkinData;
ToolBar1: TToolBar;
ToolButton2: TToolButton;
ToolButton1: TToolButton;
ToolButton3: TToolButton;
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
MainForm: TMainForm;implementation{$R *.dfm}
uses Unit2, Unit3;
procedure TMainForm.ToolButton1Click(Sender: TObject);
begin
if not assigned(InputForm) then
begin
InputForm:=TInputForm.Create(self);
InputForm.Show;
end else
InputForm.Width:=MainForm.ClientWidth;
InputForm.Height:=MainForm.ClientHeight;
InputForm.Top:=0;
InputForm.Left:=0;
InputForm.WindowState:=wsMaximized;
InputForm.BringToFront;
end;procedure TMainForm.ToolButton2Click(Sender: TObject);
begin
if not assigned(ViewForm) then
begin
ViewForm:=TViewForm.Create(self);
VIewForm.Show;
end else
ViewForm.Width:=MainForm.ClientWidth;
ViewForm.Height:=MainForm.ClientHeight;
ViewForm.Top:=0;
ViewForm.Left:=0;
ViewForm.WindowState:=wsMaximized;
ViewForm.BringToFront;
end;end.
子窗体代码:
unit Unit2;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ToolWin, ComCtrls, Buttons;type
TInputForm = class(TForm)
RichEdit1: TRichEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
Edit1: TEdit;
Label1: TLabel;
BitBtn5: TBitBtn;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure CreateParams(var Params: TCreateParams); override;
private
{ Private declarations }
public
{ Public declarations }
end;var
InputForm: TInputForm;implementation{$R *.dfm}Procedure TInputForm.CreateParams( var Params : tCreateParams );
Begin
Inherited CreateParams( Params );
Params.Style := Params.Style and (not WS_CAPTION);
End;procedure TInputForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Self:=nil;
Action:=caFree;
end;end.只有这样才能隐藏掉该死的标题栏,但是问题是切换时总有闪烁一下标题栏还有一个问题,我用了vclskin后,如果主窗体有菜单的话,菜单旁边总是有子窗体的三个按钮,怎么去掉?谢谢!
解决方案 »
- 请教:网络编程高手
- 点击查询时老是提示: CommandText are changes not allowed 会是什么问题呢?
- 客户端不能访问服务器上的COM+组件
- 正常情况下,需要同时通过网络操作远端的数据库,但是网断的时候那,怎么才能不影响工作?
- 为什么TADOQuery不支持DeleteRecords批量删除记录?请知道原因的朋友指教,谢谢。
- 急!!!如何调用后缀为chm的外部程序?!!!!
- 能否给Query动态增加Field,如能增加,请示例.
- 关于进度条ProgressBar1的用法?
- 数据库引擎错误(BDE)
- 怎样打开文本文件,并读去其中一行?
- 驗證數據,很急
- 快过节了,祝大家春节快乐!
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, Menus, WinSkinData;type
TMainForm = class(TForm)
SkinData1: TSkinData;
ToolBar1: TToolBar;
ToolButton2: TToolButton;
ToolButton1: TToolButton;
ToolButton3: TToolButton;
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
MainForm: TMainForm;implementation{$R *.dfm}
uses Unit2, Unit3;
procedure TMainForm.ToolButton1Click(Sender: TObject);
begin
lockwindowupdate(handle);
if not assigned(InputForm) then
begin
InputForm:=TInputForm.Create(self);
InputForm.Width:=MainForm.ClientWidth;
InputForm.Height:=MainForm.ClientHeight;
InputForm.Top:=0;
InputForm.Left:=0;
if InputForm.WindowState<>wsMaximized then InputForm.WindowState:=wsMaximized;
end else
begin
InputForm.Width:=MainForm.ClientWidth;
InputForm.Height:=MainForm.ClientHeight;
InputForm.Top:=0;
InputForm.Left:=0;
if InputForm.WindowState<>wsMaximized then InputForm.WindowState:=wsMaximized;
InputForm.setfocus;
end;
lockwindowupdate(0);
end;procedure TMainForm.ToolButton2Click(Sender: TObject);
begin
lockwindowupdate(handle);
if not assigned(ViewForm) then
begin
ViewForm:=TViewForm.Create(self);
ViewForm.Width:=MainForm.ClientWidth;
ViewForm.Height:=MainForm.ClientHeight;
ViewForm.Top:=0;
ViewForm.Left:=0;
if ViewForm.WindowState<>wsMaximized then ViewForm.WindowState:=wsMaximized;
end else
begin
ViewForm.Width:=MainForm.ClientWidth;
ViewForm.Height:=MainForm.ClientHeight;
ViewForm.Top:=0;
ViewForm.Left:=0;
if ViewForm.WindowState<>wsMaximized then ViewForm.WindowState:=wsMaximized;
ViewForm.setfocus;
end;
lockwindowupdate(0);
end;end.这样倒是不闪了,但每次点击button总是窗体要动一下,烦躁!