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?
Kevin Spencer - 08 Jun 2007 11:53 GMT
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.

Signature
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
>I have a class derived from UserControl. The control displays a layout
>that
[quoted text clipped - 12 lines]
>
> Is there a way to do this or is my architecture incorrect?
Nick - 12 Jun 2007 07:04 GMT
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
Nick - 12 Jun 2007 10:36 GMT
ControlPaint.DrawReversibleLine(PointToScreen(_ps),PointToScreen(pc),
Color.Black);

Signature
Just look up
> 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
[quoted text clipped - 7 lines]
> Nick
> nick_azrael@hotmail.com
Nick - 12 Jun 2007 11:04 GMT
ControlPaint.DrawReversibleLine(PointToScreen(_ps),PointToScreen(pc),
Color.Black);

Signature
Just look up
> I have a class derived from UserControl. The control displays a layout that
> I want to use on several different controls/forms. The containing
[quoted text clipped - 8 lines]
>
> Is there a way to do this or is my architecture incorrect?