K
kamleshgk
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 on top of user controls and other controls, which
are placed in the container control...
I'm using System.Drawing namespace (C#) 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?
Or is there any other way?
Thanx in advance for any help!
Kamlesh
Programmer - Cognizant Technology Solutions
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 on top of user controls and other controls, which
are placed in the container control...
I'm using System.Drawing namespace (C#) 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?
Or is there any other way?
Thanx in advance for any help!
Kamlesh
Programmer - Cognizant Technology Solutions