Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2007

Tip: Looking for answers? Try searching our database.

Control drawing over contained control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
KenDev - 07 Jun 2007 15:15 GMT
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?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.