Get notification for when a control is enters view in c#?
If I have a windows forms ScrollablePanel-based container and populate it with enough controls so that its actual size exceeds its view size, I can invoke the function ScrollIntoView to ensure Control X is in view.
But when the 开发者_如何学编程user scrolls the panel manually how can I get notification when Control X enters and exits the view?
You could use the Rectangle.Contains method with something like this:
if(container.Bounds.Contains(ControlX.Bounds))
{
// I'm in the zone chief
}
This would go in the scroll event of the container control.
精彩评论