//////////////这个程序只是隐藏了标题栏,其他的就不能帮你忙了unit Unit1;interfaceuses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls, Buttons, BDE, DB;
type
TForm1 = class(TForm)
Button1 : TButton;
procedure Button1Click(Sender: TObject);
private
procedure CreateParams(VAR Params: TCreateParams); override;
procedure WMNCHitTest(VAR Msg: TWMNcHitTest); message WM_NCHITTEST;
end;
var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.CreateParams(VAR Params: TCreateParams);
begin
Inherited CreateParams(Params);
WITH Params DO
Style := (Style OR WS_POPUP) AND (NOT WS_DLGFRAME);
end;procedure TForm1.WMNCHitTest(var msg: TWMNCHitTest);
begin
inherited;
if (msg.Result = htClient) then
msg.Result := htCaption;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
Close;
end;end.
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls, Buttons, BDE, DB;
type
TForm1 = class(TForm)
Button1 : TButton;
procedure Button1Click(Sender: TObject);
private
procedure CreateParams(VAR Params: TCreateParams); override;
procedure WMNCHitTest(VAR Msg: TWMNcHitTest); message WM_NCHITTEST;
end;
var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.CreateParams(VAR Params: TCreateParams);
begin
Inherited CreateParams(Params);
WITH Params DO
Style := (Style OR WS_POPUP) AND (NOT WS_DLGFRAME);
end;procedure TForm1.WMNCHitTest(var msg: TWMNCHitTest);
begin
inherited;
if (msg.Result = htClient) then
msg.Result := htCaption;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
Close;
end;end.
TForm1......
......
procedure WMNCHITTEST(var Msg:TWMNCHITTEST); message WM_NCHITTEST;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.WMNCHITTEST(var Msg: TWMNCHITTEST);
var
vPoint: TPoint;
vRect: TRect;
begin
GetWindowRect(Handle, vRect);
vPoint.X := Msg.XPos;
vPoint.Y := Msg.YPos;
if PtInRect(Rect(vRect.Right - 5, vRect.Top + 5, vRect.Right + 5,
vRect.Bottom - 5), vPoint) then
Msg.Result := HTRIGHT
else if PtInRect(Rect(vRect.Left - 5, vRect.Top + 5, vRect.Left + 5,
vRect.Bottom - 5), vPoint) then
Msg.Result := HTLEFT
else if PtInRect(Rect(vRect.Left + 5, vRect.Top - 5, vRect.Right - 5,
vRect.Top + 5), vPoint) then
Msg.Result := HTTOP
else if PtInRect(Rect(vRect.Left + 5, vRect.Bottom - 5, vRect.Right - 5,
vRect.Bottom + 5), vPoint) then
Msg.Result := HTBOTTOM
else if PtinRect(Rect(vRect.Left - 5, vRect.Top - 5, vRect.Left + 5,
vRect.Top + 5), vPoint) then
Msg.Result := HTTOPLEFT
else if PtInRect(Rect(vRect.Right - 5, vRect.Bottom - 5, vRect.Right + 5,
vRect.Bottom + 5), vPoint) then
Msg.Result := HTBOTTOMRIGHT
else if PtInRect(Rect(vRect.Left - 5, vRect.Bottom - 5, vRect.Left + 5,
vRect.Bottom + 5), vPoint) then
Msg.Result := HTBOTTOMLEFT
else if PtInRect(Rect(vRect.Right - 5, vRect.Top - 5, vRect.Right + 5,
vRect.Left + 5), vPoint) then
Msg.Result := HTTOPRIGHT;
end;procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
Perform(WM_SYSCOMMAND, SC_MOVE + 1, 0);
end;