Delphi Form恢复状态位置和大小 [英] Delphi Form Restored State Position and Size

查看:158
本文介绍了Delphi Form恢复状态位置和大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最大化的delphi表单中,如何获取表单的还原状态位置和大小?我知道在.NET中,我们使用 RestoreBounds DesktopBound

In a maximized delphi form, how to get form's restored state position and size? I know in .NET we use RestoreBounds and DesktopBound.

推荐答案

VCL框架未公开此内容。相反,您需要使用Win32 API。您需要的功能是 GetWindowPlacement

This is not exposed by the VCL framework. Instead you need to dip into the Win32 API. The function you need is GetWindowPlacement.

var
  WindowPlacement: TWindowPlacement;
....
WindowPlacement.length := SizeOf(WindowPlacement);
Win32Check(GetWindowPlacement(Form.Handle, WindowPlacement));

您需要的信息可以在 WindowPlacement 结构。请注意,坐标是相对于工作区域而不是屏幕报告的。

The information you need can be found in the WindowPlacement struct. Do beware that the coordinates are reported with respect to the work area rather than the screen.

通常,您需要此信息,以便以后可以恢复它。使用 SetWindowPlacement 可以做到这一点。

Generally you want this information so that you can restore it at a later date. Use SetWindowPlacement to do that.

这篇关于Delphi Form恢复状态位置和大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆