开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜