2
Answers

Change of focus causes unwanted scroll

Ask a question

Hello,

I have a UserControl (UC) on a TabPage. The UC contains many standard controls (a TreeView, some TextBox controls, labels, etc.). In its minimum state the UC is too large for the tab, so I turned on autoscroll for the tab.

Here's the problem: the first time the user clicks a node in the TreeView within the UC, the TreeView control that just gained focus is scrolled to the top of the tab. I want to block this scrolling event. There are some critical buttons at the top of the UC that go out of view when the scrolling event occurs. They should remain visible as they are the next step in the workflow. Since I can't move the buttons (this UC is being reused in this tab), I want to block the scroll.

The main problem for me is that I don't know the chain of events that cause the scrolling event to fire. I know that the focus event initiates the chain of events, but I don't know exactly which events follow.

Any help would be greatly appreciated.

Thank you,

Robert


Answers (2)