如题
解决方案 »
- 急急急,急到吐血!!!vb=>delphi
- 郁闷.刚刚抢分抢的头晕...散....
- 我怎么得到两个字符串之间的字符串值(请教高手)
- 高高高手进来!!!!!!!!
- 我要送分,快来!
- 如何将货币型转换为字符型?并以*,***,***格式
- 关于StringGrid使用的两个问题
- ***小题目难倒众好汉:Delphi能制作自定义组件或ActiveX控件吗?*****
- 数据库漏洞扫描专业工具——DBScan for Oracle
- 找李维的 Delphi5.x 分布式多层应用系统篇 下载地址
- 请问怎么自动给combobox的items自动赋值?
- 高分求援!怎样读取外部程序的StringGrid表格中所有内容?
放个panel,然后 Align = alClient
BevelOuter = bvNone
Caption = ''保证看不出来:)
但是如何显示MDI子窗体啊?
截取这个消息WM_NCCALCSIZE,最好不要去试, 我要是你我就fsNormal了:)
不但没有去掉,反而变成两层边框了。哈哈
procedure ShowMDIClientEdge(ClientHandle: THandle; ShowEdge: Boolean);
var
Style: Longint;
begin
if ClientHandle <> 0 then
begin
Style := GetWindowLong(ClientHandle, GWL_EXSTYLE);
if ShowEdge then
if Style and WS_EX_CLIENTEDGE = 0 then
Style := Style or WS_EX_CLIENTEDGE
else
Exit
else if Style and WS_EX_CLIENTEDGE <> 0 then
Style := Style and not WS_EX_CLIENTEDGE
else
Exit;
SetWindowLong(ClientHandle, GWL_EXSTYLE, Style);
SetWindowPos(ClientHandle, 0, 0,0,0,0, SWP_FRAMECHANGED or SWP_NOACTIVATE or
SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER);
end;
end;
兄弟, 俺在俺回答之前早就看过了(肯定在你之前:)), 并且还试过了, 这是咱的条件反射
哪个我也早就看了,但是没有用啊
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, jpeg, Buttons;type
TForm1 = class(TForm)
private
FOldClientProc,
FNewClientProc:TFarProc;
procedure ClientWndProc(var Message: TMessage);
public
procedure CreateWnd;Override;
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure ShowMDIClientEdge(ClientHandle: THandle; ShowEdge: Boolean);
var
Style: Longint;
begin
if ClientHandle <> 0 then
begin
Style := GetWindowLong(ClientHandle, GWL_EXSTYLE);
if ShowEdge then
if Style and WS_EX_CLIENTEDGE = 0 then
Style := Style or WS_EX_CLIENTEDGE
else
Exit
else if Style and WS_EX_CLIENTEDGE <> 0 then
Style := Style and not WS_EX_CLIENTEDGE
else
Exit;
SetWindowLong(ClientHandle, GWL_EXSTYLE, Style);
SetWindowPos(ClientHandle, 0, 0,0,0,0, SWP_FRAMECHANGED or SWP_NOACTIVATE or
SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER);
end;
end;procedure TForm1.ClientWndProc(var Message: TMessage);
begin
with Message do
case Msg of
$3F:
begin
if FormStyle = fsMDIForm then
ShowMDIClientEdge(ClientHandle,false);
end;
else
Result := CallWindowProc(FOldClientProc, ClientHandle, Msg, wParam, lParam);
end;
end;procedure TForm1.CreateWnd;
begin
inherited CreateWnd;
FNewClientProc:=MakeObjectInstance(ClientWndProc);
FOldClientProc:=pointer(GetWindowLong(ClientHandle,GWL_WNDPROC));
SetWindowLong(ClientHandle,GWL_WNDPROC,Longint(FNewClientProc));
end;end.
虽然我也实现了,但是还会开贴的。
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus;type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
a1: TMenuItem;
miNewChild: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure miNewChildClick(Sender: TObject);
private
FPrevWndProc, FNewWndProc: TFarProc;
procedure ClientWndProc(var Message: TMessage);
public
{ Public declarations }
end;var
Form1: TForm1;implementationuses Unit2;{$R *.dfm}procedure TForm1.ClientWndProc(var Message: TMessage);
begin
with Message do
begin
case Msg of
WM_NCACTIVATE,
WM_NCCALCSIZE:
SetWindowLong(ClientHandle, GWL_EXSTYLE, GetWindowLong(ClientHandle, GWL_EXSTYLE) and not WS_EX_CLIENTEDGE);
end;
Result := CallWindowProc(FPrevWndProc, ClientHandle, Msg, WParam, LParam);
end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
if ClientHandle <> 0 then
begin
FNewWndProc := MakeObjectInstance(ClientWndProc);
FPrevWndProc := Pointer(GetWindowLong(ClientHandle, GWL_WNDPROC));
SetWindowLong(ClientHandle, GWL_WNDPROC, Integer(FNewWndProc));
end;
end;procedure TForm1.FormDestroy(Sender: TObject);
begin
if ClientHandle <> 0 then
begin
SetWindowLong(ClientHandle, GWL_WNDPROC, Integer(FPrevWndProc));
FreeObjectInstance(FNewWndProc);
end;
end;procedure TForm1.miNewChildClick(Sender: TObject);
begin
with TForm2.Create(Application) do Show;
end;end.
--------------------------------------------------------------------------------
unit Unit2;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm2 = class(TForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;{var
Form2: TForm2;}implementation{$R *.dfm}procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;end.