如何改变窗体的大小
时间:2011-12-21
来源:互联网
Delphi(Pascal) code
用这样的方式建立一个类似bsnone样式的窗口,怎么才能改变它大小就是像bsSizeable那种
with Wnd do begin style := CS_HREDRAW or CS_VREDRAW; {改变大小时重绘} cbClsExtra := 0; {没有额外的窗口类信息} cbWndExtra := 0; {没有额外的窗口信息} hIcon := 0; {没指定图标} hCursor := LoadCursor(0, IDC_ARROW); {选用了系统提供的指针} lpszMenuName := nil; {不指定默认菜单} lpfnWndProc := @WndNewProc; hInstance := hInstance; lpszClassName := LayeredWndClass; hbrBackground :=CreateSolidBrush(RGB(0, 0,0)); end; Windows.RegisterClass(Wnd); Hnd:=CreateWindowEx(WS_EX_TOOLWINDOW , LayeredWndClass, PChar(form1.Caption), WS_VISIBLE or WS_POPUP , form1.Left, form1.Top, form1.Width, form1.Height, form1.Handle, 0, HInstance, nil);
用这样的方式建立一个类似bsnone样式的窗口,怎么才能改变它大小就是像bsSizeable那种
作者: ncliang 发布时间: 2011-12-21
private
procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHITTEST;
procedure TForm2.WmNcHitTest(var msg:TWmNcHitTest);
const cOffset=10;
var
vPoint: TPoint;
begin inherited;
vPoint:= ScreenToClient(Point(Msg.XPos, Msg.YPos));
if PtInRect(Rect(0, 0, cOffset, cOffset),vPoint) then Msg.Result := HTTOPLEFT
else if PtInRect(Rect(Width - cOffset, Height - cOffset, Width, Height), vPoint) then Msg.Result := HTBOTTOMRIGHT
else if PtInRect(Rect(Width - cOffset, 0, Width, cOffset), vPoint) then Msg.Result := HTTOPRIGHT
else if PtInRect(Rect(cOffset, 0, Width - cOffset, cOffset), vPoint) then Msg.Result := HTTOP
else if PtInRect(Rect(0, cOffset, cOffset, Height - cOffset), vPoint) then Msg.Result := HTLEFT
else if PtInRect(Rect(Width - cOffset, cOffset, Width, Height - cOffset), vPoint) then Msg.Result := HTRIGHT
else if PtInRect(Rect(cOffset, Height - cOffset, Width - cOffset, Height), vPoint) then Msg.Result := HTBOTTOM;
end;
procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHITTEST;
procedure TForm2.WmNcHitTest(var msg:TWmNcHitTest);
const cOffset=10;
var
vPoint: TPoint;
begin inherited;
vPoint:= ScreenToClient(Point(Msg.XPos, Msg.YPos));
if PtInRect(Rect(0, 0, cOffset, cOffset),vPoint) then Msg.Result := HTTOPLEFT
else if PtInRect(Rect(Width - cOffset, Height - cOffset, Width, Height), vPoint) then Msg.Result := HTBOTTOMRIGHT
else if PtInRect(Rect(Width - cOffset, 0, Width, cOffset), vPoint) then Msg.Result := HTTOPRIGHT
else if PtInRect(Rect(cOffset, 0, Width - cOffset, cOffset), vPoint) then Msg.Result := HTTOP
else if PtInRect(Rect(0, cOffset, cOffset, Height - cOffset), vPoint) then Msg.Result := HTLEFT
else if PtInRect(Rect(Width - cOffset, cOffset, Width, Height - cOffset), vPoint) then Msg.Result := HTRIGHT
else if PtInRect(Rect(cOffset, Height - cOffset, Width - cOffset, Height), vPoint) then Msg.Result := HTBOTTOM;
end;
作者: guge8888 发布时间: 2011-12-21
这样我知道,但是我是想改变 CreateWindowEx创建这个窗体的大小
作者: ncliang 发布时间: 2011-12-21
查下SDK不就出来了
作者: CatSmoking 发布时间: 2011-12-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28