如何防止窗户移动? [英] How do you prevent a windows from being moved?
本文介绍了如何防止窗户移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将如何阻止表单移动。我将窗体边框样式设置为FixedSingle,并希望保持这种方式,因为它在Vista中看起来不错:)
How would i go about stopping a form from being moved. I have the form border style set as FixedSingle and would like to keep it this way because it looks good in vista :)
推荐答案
看看此链接一个>。您可能对选项3感兴趣。它将要求您包装一些本机代码,但应该可以工作。链接底部还有一条注释,显示了一种更简单的方法。从评论中摘录(无法获得赞誉,但我会为您节省一些搜索时间):
Take a look at this link. You might be interested in option #3. It will require you to wrap some native code, but should work. There's also a comment at the bottom of the link that shows an easier way to do it. Taken from the comment (can't take credit for it, but I'll save you some searching):
protected override void WndProc(ref Message message)
{
const int WM_SYSCOMMAND = 0x0112;
const int SC_MOVE = 0xF010;
switch(message.Msg)
{
case WM_SYSCOMMAND:
int command = message.WParam.ToInt32() & 0xfff0;
if (command == SC_MOVE)
return;
break;
}
base.WndProc(ref message);
}
这篇关于如何防止窗户移动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文