当儿童coltrol焦点时,Autoscoll面板 [英] Autoscoll panel when child coltrol focus

查看:71
本文介绍了当儿童coltrol焦点时,Autoscoll面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello gyes,

我有多个儿童控制面板控制器



我的问题是:



,当我的孩子控制在面板底部

他们没有显示在显示区域bcoz他们隐藏在面板和面板自动滚动不工作





当底部儿童控制器获得焦点时我想要面板自动滚动..



我是什么尝试过:



MyPanel.AutoScrollPosition = new Point(MyPanel.X,FocusControl.Y);



他们没有工作

解决方案

我给你的建议有两个:

- 不要使用GotFocus-来自ChildControl的活动。只有单击它时,ChildControl才会获得焦点。我将采用鼠标悬停在ChildControl上时触发的MouseHover-Event。

- 要移动Panel本身,你应该使用Panel.ScrollControlIntoView-Method。当您调用此方法时,您可以为其指定要滚动的控件。然后看起来像:

 MyPanel.ScrollControlIntoView(FocusControl); 

此处FocusControl必须是Event-Method的发件人。


Hello gyes,
I have panel control with multiple child control

My problem is:

when my child control in bottom of panel
they not display in display area bcoz they hide under panel and panel auto scroll not work


I want to panel auto scroll when bottom child control get focus..

What I have tried:

MyPanel.AutoScrollPosition=new Point(MyPanel.X,FocusControl.Y);

They not work

解决方案

There a 2 suggestions I give to you :
- don't use the GotFocus-Event from the ChildControl. The ChildControl gets the Focus only if you Click it. I would take the MouseHover-Event which is fired when the Mouse is over the ChildControl.
- for shifting the Panel itself you should use the Panel.ScrollControlIntoView-Method. When you call this Method you give it the Control to which you want to scroll. Then it looks like :

MyPanel.ScrollControlIntoView(FocusControl);

here FocusControl must be the sender from the Event-Method.


这篇关于当儿童coltrol焦点时,Autoscoll面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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