EDN Admin
Well-known member
Hi,
I have a requirement to draw a rectangle and a line on a the container control and sometimes as i move the mouse the drawing must occur seamlessly on user controls and other controls...
Im using System.Drawing namespace to perform the drawing.
But as i move the mouse and draw the rectangles, the drawing takes place behind the user controls....I have a requirement to draw the shapes on top of the controls...
I scrounged the net to find that there is a WIN 32 style property that can be set to paint over child controls..
public static int WS_CLIPCHILDREN = 0x02000000;
protected override CreateParams CreateParams
{ get
{ CreateParams cp = base.CreateParams;
cp.Style &= (~WS_CLIPCHILDREN);
return cp;
}
}
This worked!!!! The rectangle was drawn over the child controls.
But this has problems, when ever i tried scrolling the screen there were lots of flickering and painting issues...
Is there any optimized method/property in the System.Drawing namespace which can be used to draw over child controls.
Thanx in advance for any help!
Kamlesh
Programmer - Cognizant Technology Solutions
View the full article
I have a requirement to draw a rectangle and a line on a the container control and sometimes as i move the mouse the drawing must occur seamlessly on user controls and other controls...
Im using System.Drawing namespace to perform the drawing.
But as i move the mouse and draw the rectangles, the drawing takes place behind the user controls....I have a requirement to draw the shapes on top of the controls...
I scrounged the net to find that there is a WIN 32 style property that can be set to paint over child controls..
public static int WS_CLIPCHILDREN = 0x02000000;
protected override CreateParams CreateParams
{ get
{ CreateParams cp = base.CreateParams;
cp.Style &= (~WS_CLIPCHILDREN);
return cp;
}
}
This worked!!!! The rectangle was drawn over the child controls.
But this has problems, when ever i tried scrolling the screen there were lots of flickering and painting issues...
Is there any optimized method/property in the System.Drawing namespace which can be used to draw over child controls.
Thanx in advance for any help!
Kamlesh
Programmer - Cognizant Technology Solutions
View the full article