简体   繁体   English

启动WinForm应用程序Aerosnaped Right Aligned

[英]Launch WinForm application Aerosnaped Right Aligned

This should be a simple question, but search-foo has failed me. 这应该是一个简单的问题,但是search-foo让我失望了。 My goal is to detect that I'm running under Aero (Vista or Windows 7) and have my application Aerosnap by default. 我的目标是检测我是在Aero(Vista或Windows 7)下运行并默认使用我的应用程序Aerosnap。 (It turns out that a corporate application I wrote is run by pretty much everyone aerosnapped right, with their Outlook snapped left.) (事实证明,我写的一个公司应用程序是由几乎所有人正确运行的,他们的Outlook向左拍摄。)

The application is WinForms and I'm currently doing 该应用程序是WinForms,我目前正在做

Width = Screen.PrimaryScreen.WorkingArea.Size.Width / 2;
Height = Screen.PrimaryScreen.WorkingArea.Size.Height;
Top = Screen.PrimaryScreen.WorkingArea.Top;
Left = Screen.PrimaryScreen.WorkingArea.Left + 
       Screen.PrimaryScreen.WorkingArea.Size.Width / 2;

in my forms's load event. 在我的表单的加载事件中。 This works great, except that if they use WindowKey+Arrow, it acts as if it was just a normally located form. 这很好用,除非他们使用WindowKey + Arrow,它就好像它只是一个正常位置的形式。 This means WindowKey+Right does nothing on first press and WindowKey+Left snaps left. 这意味着WindowKey + Right在第一次按下时不执行任何操作,并且WindowKey + Left向左按下。 This isn't a major problem, but I would prefer if I could specify a window size and then snap the application to the Right so those keys act as they would with any other application. 这不是一个主要问题,但我更愿意,如果我可以指定一个窗口大小然后将应用程序捕捉到右侧,那么这些键的行为与任何其他应用程序一样。

I'm not sure this is possible, here are the things I did find: 我不确定这是可能的,以下是我找到的东西:

These seem to indicate that there is no special AeroSnap message available. 这些似乎表明没有可用的特殊AeroSnap消息。 Anyone know otherwise? 有人知道吗?

Not sure why checking for version wouldn't get you most of the way. 不确定为什么检查版本不会让你大部分时间。 How to determine the Windows version by using Visual C# http://support.microsoft.com/kb/304283 如何使用Visual C# http://support.microsoft.com/kb/304283确定Windows版本

This might get you the rest of the way. 这可能会让你完成其余的工作。 http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/1a82ec8d-afc3-4eba-8189-6ee105aa6249 http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/1a82ec8d-afc3-4eba-8189-6ee105aa6249

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM