Yes, I just did it. The concept is fairly easy to implement if you are managing your own custom container control ( which I'm fairly certain is what you are doing based on the thread ). To implement this; however, you need to use only custom child controls or child controls that have OnPaint() overridden so that you can interject a clipping region prior to the child control being rendered. 1. In your custom container control, in the OnPaint() event, calculate the desired client area GraphicsPath. Save that path as a public member for later use by chlid controls, let's name it 'ClientAreaPath' for fun. 2. For any control that can be added to your custom container, define the control as a custom control, or at least inherit and override the OnPaint() event. 3. In your child controls, in the OnPaint() override, determine if the control is a child of your custom container and, if so, then transform and apply the ClientAreaPath that was calculated and saved in step #1 above. Viola - non-rectangular clipping :-) Here's a rough c# outline of the child control OnPaint() operations. public override void OnPaint( PaintEventArgs e ) { // determine if this control is parented and if the parent can supply a ClientAreaPath try { // attempt to cast, will cause exception if nothing else MyCustomContainer parentContainer = ( MyCustomContainer )Parent; // get a copy of the custom client path GraphicsPath p = new GraphicsPath(parentContainer.ChildPath.PathPoints, parentContainer.ChildPath.PathTypes); // transfrom the path to be relative to the client (critical step here) // all paths are "zero-relative" so the client needs to see this path expressed // not as zero-relative, but client-location relative instead Matrix translateMatrix = new Matrix(); translateMatrix.Translate(-(Location.X), -(Location.Y)); p.Transform(translateMatrix); // now apply a nice clipping region to the control's graphics object so that //
R
rnendel
@rnendel