user164771
user164771

Reputation:

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 would be to place a panel in my control and then use that as their parent.

Upvotes: 1

Views: 654

Answers (1)

itowlson
itowlson

Reputation: 74802

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).

Upvotes: 1

Related Questions