I have a class derived from UserControl. The control displays a layout that
I want to use on several different controls/forms. The containing
control/form would then paint over the layout with additional information.
The problem is that when I draw a line in the control containing the layout
control (in my case, another UserControl derived class), the line is behind
the layout control. I have tried turning off the WS_CLIPCHILDREN style in
the CreateParams, but that doesn't seem to make a difference.

I want to avoid drawing all possibilities in the layout control, but cannot
find the right code to do it.

Is there a way to do this or is my architecture incorrect?

Re: Control drawing over contained control by Kevin

Kevin
Fri Jun 08 05:53:04 CDT 2007

The problem here is that you have a Control "inside" another Control. This
puts the child Control "on top of" the container Control. It has a higher
Z-index than the Control in which it resides. If you want to draw on top of
the child Control, you need to put a Control into the container that
overlaps it and is at a higher Z-index.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"KenDev" <KenDev@discussions.microsoft.com> wrote in message
news:E34CC51D-584F-428C-B15C-DE64B2D4E10E@microsoft.com...
>I have a class derived from UserControl. The control displays a layout
>that
> I want to use on several different controls/forms. The containing
> control/form would then paint over the layout with additional information.
> The problem is that when I draw a line in the control containing the
> layout
> control (in my case, another UserControl derived class), the line is
> behind
> the layout control. I have tried turning off the WS_CLIPCHILDREN style in
> the CreateParams, but that doesn't seem to make a difference.
>
> I want to avoid drawing all possibilities in the layout control, but
> cannot
> find the right code to do it.
>
> Is there a way to do this or is my architecture incorrect?



Re: Control drawing over contained control by Nick

Nick
Tue Jun 12 01:04:01 CDT 2007

Is there any other way to draw the line on the top of child control?
I find a software "Altova MAPFORCE" could do this.When i used spy++ to
trace its' window, i could only find a tree child control.And it seems there
is no any line child control.It does draw the line on the container
control.How ?
I had ever though of using GetDC(0)...ï¼?to draw the line on the
screen.Surely it does work.But i don't think it' the best way for this
question?

Nick
nick_azrael@hotmail.com



Re: Control drawing over contained control by Nick

Nick
Tue Jun 12 04:36:17 CDT 2007

ControlPaint.DrawReversibleLine(PointToScreen(_ps),PointToScreen(pc),
Color.Black);
--
Just look up


"Nick" wrote:

> Is there any other way to draw the line on the top of child control?
> I find a software "Altova MAPFORCE" could do this.When i used spy++ to
> trace its' window, i could only find a tree child control.And it seems there
> is no any line child control.It does draw the line on the container
> control.How ?
> I had ever though of using GetDC(0)...ï¼?to draw the line on the
> screen.Surely it does work.But i don't think it' the best way for this
> question?
>
> Nick
> nick_azrael@hotmail.com
>
>

RE: Control drawing over contained control by Nick

Nick
Tue Jun 12 05:04:04 CDT 2007


ControlPaint.DrawReversibleLine(PointToScreen(_ps),PointToScreen(pc),
Color.Black);

--
Just look up


"KenDev" wrote:

> I have a class derived from UserControl. The control displays a layout that
> I want to use on several different controls/forms. The containing
> control/form would then paint over the layout with additional information.
> The problem is that when I draw a line in the control containing the layout
> control (in my case, another UserControl derived class), the line is behind
> the layout control. I have tried turning off the WS_CLIPCHILDREN style in
> the CreateParams, but that doesn't seem to make a difference.
>
> I want to avoid drawing all possibilities in the layout control, but cannot
> find the right code to do it.
>
> Is there a way to do this or is my architecture incorrect?