Click here to Skip to main content
15,901,426 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 15-Mar-16 9:36am
v2

1 solution

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 :
C#
MyPanel.ScrollControlIntoView(FocusControl);
here FocusControl must be the sender from the Event-Method.
 
Share this answer
 
Comments
Manamohan Jha 17-Mar-16 5:37am    
In which event they proper work??
Ralf Meier 17-Mar-16 7:55am    
I don't understand the question ...
What I would do is :
take the MouseHover-Eventhandler from all Controls inside the Panel and Redirect them to the same MouseHover-Method. in this MouseHover-Method you call the ScrollControlIntoView-Method with the Sender of the MouseHover-Method. Now you Panel automaticly scrolls down (and also up) when the Mouse is Over one of the ChildControls which are in the Border-Area of the Panel.
Did you get me ...?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900