无边框窗体最大化覆盖了任务栏

CruelYoung123 2006-11-25 03:32:52
无边框窗体最大化覆盖了任务栏

这是什么原因....

怎么解决这个问题?

...全文
283 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
CruelYoung123 2006-11-26
  • 打赏
  • 举报
回复
谢谢各位了....呵呵
CruelYoung123 2006-11-26
  • 打赏
  • 举报
回复
我是在CanResize事件中写的代码:感觉更好一些:

if (NewWidth > Screen->WorkAreaWidth)
NewWidth = Screen->WorkAreaWidth;
if (NewHeight > Screen->WorkAreaHeight)
NewHeight = Screen->WorkAreaHeight;
nadel 2006-11-25
  • 打赏
  • 举报
回复
截获系统消息,然后改写窗体最大化高度。Screen.WorkAreaHeight就是屏幕高度减去任务栏的高度。

定义:
procedure WMGetMinMaxInfo(var mes: TWMGetMinMaxInfo);message WM_GetMinMaxInfo;
实现:
procedure TForm1.WMGetMinMaxInfo(var mes: TWMGetMinMaxInfo);
begin
mes.MinMaxInfo.ptMaxSize.X := Screen.Width;
mes.MinMaxInfo.ptMaxSize.Y := Screen.WorkAreaHeight;
mes.Result := 0;
inherited;
end;
老冯 2006-11-25
  • 打赏
  • 举报
回复
......
Self.Height := Screen.Height -30;
......

30:表示任务栏的高度 当然你也用下面的函数可以计算

function TaskBarHeight: integer;
var
hTB: HWND;
TBRect: TRect;
begin
hTB:= FindWindow('Shell_TrayWnd', '');
if hTB = 0 then
Result := 0
else begin
GetWindowRect(hTB, TBRect);
Result := TBRect.Bottom - TBRect.Top;
end;
end;
老冯 2006-11-25
  • 打赏
  • 举报
回复
DELPHI在FORMS的源玛中就是这样设置的.
解决很简单,在ONRESIZE中加入下列代码:

procedure TForm1.FormResize(Sender: TObject);
begin
if (Self.WindowState = wsMaximized) and (BorderStyle = bsNone) then
Self.Height := Screen.Height -30;
end;




5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧