Crop a child control to a region in .NET WinForms
I am currently designing a user control which will have other controls contained within it. I would like to be able to control the region in which the they are rendered (similar to Graphics.SetClip
).
Ideally I would like to beable to have them render to an off screen image which I then present to the user as I choose. The last resort w开发者_开发百科ould be to place a panel in my control and then use that as their parent.
Set the Control.Region property of the child controls. From the docs:
The operating system does not display any portion of a window that lies outside of the window region.
Note the region is relative to control on which it is set, not your containing control (unlike Graphics.SetClip).
精彩评论