如何使用 Windows API 以编程方式调整窗口大小和移动窗口? [英] How do you programmatically resize and move windows with the Windows API?

查看:68
本文介绍了如何使用 Windows API 以编程方式调整窗口大小和移动窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 Windows API 以编程方式调整窗口大小和移动窗口?

How do you programmatically resize and move windows with Windows API?

场景是:我想垂直平铺两个窗口(80%/20% 宽度比例).

The scenario is: I want to vertically tile two windows (80%/20% width proportions).

推荐答案

对于无闪烁、同时定位两个(或更多)窗口,最好的办法是使用 BeginDeferWindowPos(), DeferWindowPos()EndDeferWindowPos().就您而言,由于您同时移动两个,这是您最好的选择.

For flicker-free, simultaneously positioning two (or more) windows, your best bet is to use BeginDeferWindowPos(), DeferWindowPos() and EndDeferWindowPos(). In your case, since you're moving two at the same time, this is your best bet.

您可能还会考虑的三个较旧、更简单的函数是 SetWindowPos()MoveWindow()AdjustWindowRectEx().

Three older, simpler functions you might also consider are SetWindowPos(), MoveWindow() and AdjustWindowRectEx().

这篇关于如何使用 Windows API 以编程方式调整窗口大小和移动窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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