还是窗口的标题栏问题(200分)

  • 主题发起人 主题发起人 hippoGao
  • 开始时间 开始时间
H

hippoGao

Unregistered / Unconfirmed
GUEST, unregistred user!
1。请问各位,我改了form的borderStyle:=bsNone属性,做了一个类似金山词霸的
假标题栏,但是这个form不能修改大小,这个应该怎么修改?
2。如果仍然使用windows自己的标题栏,应该如何才能得到,可以不可以用贴图进行
完成,以便能根据用户要求修改自己的标题栏?
3。在oicq中,拉伸窗口时,北京图片也会跟随拉伸,请问这是如何得到的?
谢谢
 
1.可以用按钮触发form1.width:=form1.width+10;
 
〉背景图片也会跟随拉伸
放一个TImage上去,stretch属性为true,align为alClient
 
BorderStyled设为bsNone后,如何显示三维的窗口,现在总是平铺状态
 
干脆不要标题栏,可以自己灵活做假标题栏,方法很多
 
1.重載窗體的CreateParams事件,可以修改窗口,且窗口也是三維的。
procedure CreateParams(var Params: TCreateParams); override;
procedure tform1.CreateParams(var Params: TCreateParams);
Begin
inherited;
params.Style:=params.Style or WS_THICKFRAME;
end;
 
不用做假标题栏,可以用用skinengine控件(换肤控件),就可以很轻松做出金山或win xp的
窗口界面。skinengine在www.51delphi.com有download.
 
这个不带3D,平的。来自bakubaku

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
private
procedure WmNCHitTest(var Msg : TWMNCHitTest); message WM_NCHITTEST;
{ Private declarations }
public

{ Public declarations }
end;
var

Form1: TForm1;
implementation

{$R *.DFM}

procedure TForm1.WmNCHitTest(var Msg: TWMNCHitTest);
const v=10; //border width

var p:TPoint;
begin
Inherited;
p:=Point(Msg.XPos,Msg.YPos);
p:=ScreenToClient(p);
if PtInRect(Rect(0,0,v,v),p) then
Msg.Result:=HTTOPLEFT
else if PtInRect(Rect(Width-v,Height-v,Width,Height),p) then

Msg.Result:=HTBOTTOMRIGHT
else if PtInRect(Rect(Width-v,0,Width,v),p) then
Msg.Result:=HTTOPRIGHT
else if PtInRect(Rect(0,Height-v,v,Height),p) then
Msg.Result:=HTBOTTOMLEFT
else if PtInRect(Rect(v,0,Width-v,v),p) then
Msg.Result:=HTTOP

else if PtInRect(Rect(0,v,v,Height-v),p) then
Msg.Result:=HTLEFT
else if PtInRect(Rect(Width-v,v,Width,Height-v),p) then

Msg.Result:=HTRIGHT
else if PtInRect(Rect(v,Height-v,Width-v,Height),p) then
Msg.Result:=HTBOTTOM;
end;
end.
WM_NCHITTEST 的其他参数如下:



Value Location of hot spot

HTBORDER In the border of a window that does not have a sizing border

HTBOTTOM In the lower horizontal border of a window

HTBOTTOMLEFT In the lower-left corner of a window border

HTBOTTOMRIGHT In the lower-right corner of a window border

HTCAPTION In a title bar

HTCLIENT In a client area

HTERROR On the screen background or on a dividing line between windows (same as HTNOWHERE, except that the DefWindowProc function produces a system beep to indicate an error)

HTGROWBOX In a size box (same as HTSIZE)

HTHSCROLL In a horizontal scroll bar

HTLEFT In the left border of a window

HTMENU In a menu

HTNOWHERE On the screen background or on a dividing line between windows

HTREDUCE In a Minimize button

HTRIGHT In the right border of a window

HTSIZE In a size box (same as HTGROWBOX)

HTSYSMENU In a System menu or in a Close button in a child window

HTTOP In the upper horizontal border of a window

HTTOPLEFT In the upper-left corner of a window border

HTTOPRIGHT In the upper right corner of a window border

HTTRANSPARENT In a window currently covered by another window

HTVSCROLL In the vertical scroll bar

HTZOOM In a Maximize button


 
>>来自:zxb200, 时间:2002-3-25 8:39:00, ID:1000479
>>1.重載窗體的CreateParams事件,可以修改窗口,且窗口也是三維的。

同意这个~!
完整代码如下:
----------------------
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

type
TForm1 = class(TForm)
private
{ Private declarations }

public
//重载方法
procedure CreateParams(var params:TCreateParams);override;
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.CreateParams(var params:TCreateParams);
begin
Inherited createparams(params) ;
params.style:=WS_THICKFRAME or WS_POPUP or WS_BORDER;
end;
end.
 
多人接受答案了。
 
后退
顶部