开发者

Get notification for when a control is enters view in c#?

开发者 https://www.devze.com 2023-01-15 01:50 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消