Control drawing over contained control

G

Guest

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?
 
K

Kevin Spencer

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
 
G

Guest

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
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top