设置AutoScroll = true后如何关注窗体的顶部位置 [英] How to focus to Top position of form after set AutoScroll = true
本文介绍了设置AutoScroll = true后如何关注窗体的顶部位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表单,我设置Auto Scroll = true。活动表单时遇到问题。表格不是焦点到顶部位置。它会自动向下滚动到表单底部。我该如何解决? (我的意思是当我调用一个表单它将显示表单的顶部然后我可以使用滚动条向下滚动)。
对不起我的英语技能。
谢谢
I have a form and I set Auto Scroll = true . I have a problem when active the form . Form is not focus to top position . It auto scroll down to bottom of form . How can I fix it ? ( I mean when I call a form It will show the top of Form then I can use scroll bar to scroll down ).
Sorry about my english skill .
Thanks
推荐答案
在这里阅读它,你可能会对这实际上做的事感到困惑:
点击我! [ ^ ]
Read about it here, you may be confused on what this actually does:
Click me![^]
我使用此代码:
i use this code :
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr hWnd,UInt32 Msg,UInt32 wParam,UInt32 lParam);
//........
//........
private void MainForm_Load(object sender,EventArgs e)
{
//........
//...........
splitContainer1.Panel1.Focus();
int WM_MOUSEWHEEL = 0x20A;
Message msg = new Message();
msg.Msg = WM_MOUSEWHEEL;
msg.WParam = (IntPtr)786432000;
msg.HWnd = splitContainer1.Panel1.Handle;
SendMessage(msg.HWnd,(UInt32)msg.Msg,(UInt32)msg.WParam,(UInt32)msg.LParam);
}
这篇关于设置AutoScroll = true后如何关注窗体的顶部位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文