以编程方式最大化屏幕一半的窗口 [英] Programmatically Maximize Window On Half Of Screen

查看:91
本文介绍了以编程方式最大化屏幕一半的窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想最大化屏幕左侧的随机窗口。我可以从代码中使用Windows Aero功能吗?可以像使用鼠标一样最大化该窗口 。我只是想以编程方式进行操作。

I want to maximize a random window on the left side of my screen. Can I use Windows Aero functions from my code ? This window can be maximized like that with the mouse. I just want to do that programmatically.

我使用 C#可以得到窗口的IntPtr

如果可能的话,不要伪装鼠标或键盘输入。

推荐答案

虽然不完全相同,但伪造得很好:

It's not exactly the same but fakes it well:

ShowWindow(handle, SW_MAXIMIZE);
// for a split second you might see a maximized window here
MoveWindow(handle, 0, 0, Screen.PrimaryScreen.WorkingArea.Width / 2, Screen.PrimaryScreen.WorkingArea.Height, true);

这篇关于以编程方式最大化屏幕一半的窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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