主窗体的界面问题,我用了一个panel放在mainform(normalform)左面,为何我打开其它的mdichildform时,这些mdichidform
都在panel后面。我要让mdilchildform出现在panel上面.
都在panel后面。我要让mdilchildform出现在panel上面.
解决方案 »
- delphi的 .pas 文件是由哪些部分组成的?
- 编译没有错误,为什么不显示数据,那位高手指点一下
- canvase does not drawing
- Isapi 中调用 CreateOLEObject('Excel.Application') 为什么会出现错误呢?
- windows 3.x下用什么开发工具,支持DDE数据操作! 谢谢!~
- 谁有fast report ?20分
- 请问不用Form,如何建一个程序?
- 数据的录入
- Delphi 6安装后无法输入中文的问题!!!!!
- 地球人谁知道,哪能搞到FASTREPORT
- 请各位仁兄帮忙找一下Delphi的电子版图书~~~~~~~~~~~~在线等
- 一个后台运行的程序,如何获知当前运行的程序是否全屏显示(如游戏,看蝶之类)?
TMdiChild1.Create(Owner : T.....)
......
Parent := Mainform.Panel1;
....
如果上面不行的话用SetParent试试看。
unit ChildFrm;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls, Menus,math;type TChildForm = class(TForm)
Panel1: TPanel;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure WMWindowPosChanging(var msg:TWMWindowPosChanging);
message WM_WINDOWPOSCHANGING;
procedure FormResize(Sender: TObject);
private
FAsChild: Boolean;
FTempParent: TWinControl;
procedure CentalPanel;
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure Loaded; override;
public
constructor Create(AOwner: TComponent); overload; override;
constructor Create(AOwner: TComponent; AParent: TWinControl); reintroduce; overload; // The method below must be overriden to return either the main menu
// of the form, or nil.
function GetFormMenu: TMainMenu; virtual; abstract;
function CanChange: Boolean; virtual;
end;var
ChildForm: TChildForm;implementation{$R *.DFM}
procedure TChildForm.CentalPanel;
begin if panel1.Width < ClientWidth then
panel1.Left := (ClientWidth - panel1.Width ) div 2
else
panel1.Left := 0;
if panel1.Height <ClientHeight then
panel1.Top :=(ClientHeight - panel1.Height ) div 2
else
panel1.Top := 0;end;
procedure TChildForm.WMWindowPosChanging(var msg:TWMWindowPosChanging);
var
CaptionHeight:integer;
begin
CaptionHeight := GetSystemMetrics(SM_CYCAPTION);
msg.WindowPos ^.cx :=Max(msg.WindowPos ^.cx,panel1.Width+20);
msg.WindowPos ^.cy :=Max(msg.WindowPos ^.cy,panel1.Height+20+CaptionHeight);
inherited;
end;constructor TChildForm.Create(AOwner: TComponent);
begin
FAsChild := False;
inherited Create(AOwner);
end;constructor TChildForm.Create(AOwner: TComponent; AParent: TWinControl);
begin
FAsChild := True;
FTempParent := aParent;
inherited Create(AOwner);
end;procedure TChildForm.Loaded;
begin
inherited;
if FAsChild then
begin
align := alClient;
BorderStyle := bsNone;
BorderIcons := [];
Parent := FTempParent;
Position := poDefault;
end;
end;procedure TChildForm.CreateParams(var Params: TCreateParams);
Begin
Inherited CreateParams(Params);
if FAsChild then
Params.Style := Params.Style or WS_CHILD;
end;function TChildForm.CanChange: Boolean;
begin
Result := True;
end;procedure TChildForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action :=cafree;
end;procedure TChildForm.FormDestroy(Sender: TObject);
begin
ChildForm :=nil;
end;procedure TChildForm.FormResize(Sender: TObject);
begin
CentalPanel;
end;end.这是我自己写的 CHILDFORM 可以用于不同的分辨率下
var tt:tmadichildform;
begin
tt:=tmdichildform.create(application);
tt.parent:=panel1;
tt.show;
end;
这样就可以了,我试了一下,好使。
tt:tcoding_sort;
begin
tt:=tcoding_sort.create(application);
tt.parent:=mainform1.P1;
tt.show;还是显示在panel下面的,为何?请帮忙,非常谢谢!