[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

Drawing at highest z-layer???

jason

11/17/2004 2:30:00 PM

Hi --

I have a very simple question, the answer of which has eluded me for
quite some time: How can I draw at the topmost layer of forms and
controls from .NET (or from unmanaged code, that would be fine too)??

Any GDI+ drawing I've done only appears on the background of the
form/control/whatever. Anything contained by the, say, form, draws
over the custom GDI+ drawing. Now, let's say I wanted to do something
like the translucent rubber-band select in Win XP explorer: anyone
have any idea how that might be done???

Many thanks in advance,
Jason
3 Answers

Bob Powell

11/17/2004 2:49:00 PM

0

There are no "Z" layers in GDI+ except that provided by the good old
painters algorithm. Objects that appear to be on top of others are simply
drawn last.

The surfaces of controls are clipped by the window extents so if your
question is how to draw outside of that clipped area then you must obtain
the desktop window handle and draw upon that.

Like all graphics in GDI+ or indeed GDI, this process is a destructive one
and the system does not retain any information about what was there before,
it can only get windows to redraw themselves again. Therefore if you wan to
un-draw you must have made a copy of what was there in the first place
before you mucked it up with whatever you drew.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tips...

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/f...

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Jason" <jason@mailinator.com> wrote in message
news:4a8d7ea.0411170629.3668b47c@posting.google.com...
> Hi --
>
> I have a very simple question, the answer of which has eluded me for
> quite some time: How can I draw at the topmost layer of forms and
> controls from .NET (or from unmanaged code, that would be fine too)??
>
> Any GDI+ drawing I've done only appears on the background of the
> form/control/whatever. Anything contained by the, say, form, draws
> over the custom GDI+ drawing. Now, let's say I wanted to do something
> like the translucent rubber-band select in Win XP explorer: anyone
> have any idea how that might be done???
>
> Many thanks in advance,
> Jason


Josh Ross

11/23/2004 5:30:00 PM

0

I have a function that takes a handle, location and size and returns an
image.
So how do I get the obtain the desktop window handle?


"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:uYZKcSLzEHA.3820@TK2MSFTNGP11.phx.gbl...
> There are no "Z" layers in GDI+ except that provided by the good old
> painters algorithm. Objects that appear to be on top of others are simply
> drawn last.
>
> The surfaces of controls are clipped by the window extents so if your
> question is how to draw outside of that clipped area then you must obtain
> the desktop window handle and draw upon that.
>
> Like all graphics in GDI+ or indeed GDI, this process is a destructive one
> and the system does not retain any information about what was there
> before,
> it can only get windows to redraw themselves again. Therefore if you wan
> to
> un-draw you must have made a copy of what was there in the first place
> before you mucked it up with whatever you drew.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tips...
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/f...
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
> "Jason" <jason@mailinator.com> wrote in message
> news:4a8d7ea.0411170629.3668b47c@posting.google.com...
>> Hi --
>>
>> I have a very simple question, the answer of which has eluded me for
>> quite some time: How can I draw at the topmost layer of forms and
>> controls from .NET (or from unmanaged code, that would be fine too)??
>>
>> Any GDI+ drawing I've done only appears on the background of the
>> form/control/whatever. Anything contained by the, say, form, draws
>> over the custom GDI+ drawing. Now, let's say I wanted to do something
>> like the translucent rubber-band select in Win XP explorer: anyone
>> have any idea how that might be done???
>>
>> Many thanks in advance,
>> Jason
>
>


Josh Ross

11/23/2004 5:36:00 PM

0

Private Declare Auto Function GetDesktopWindow Lib "user32.dll" () As IntPtr