Re: How to draw to the screen not the form?
- From: Joergen Bech <jbech<NOSPAM>@<NOSPAM>post1.tele.dk>
- Date: Thu, 26 Oct 2006 13:41:17 +0200
Yes, that function does the same (although one is limited
to two styles then).
But the thing is: It still obtains/releases a handle to the
desktop DC under the covers. I understood from the article
I linked to in my previous post
(http://blogs.msdn.com/greg_schechter/archive/2006/05/02/588934.aspx)
that you should avoid writing to/reading from the screen (at
least for something as realtime as this, though a screen capture
program would be ok)?
I have a component where I currently draw some selection
rectangles directly on the screen (which is similar in nature to
what the original poster is attempting). Trouble is: When I run
this on Vista with Aero enabled, dragging those rectangles around
happen at a few frames a second, whereas it runs smooth
on XP (or Vista with the standard, non-Aero theme).
Wouldn't the original poster have the same problem if using
ControlPaint.DrawReversible...?
I have considered solving my own problem this way:
1. On MouseDown, grab a snapshot containing the portion of the screen
my interface occupies. Only one desktop GetDC required.
2. Put this snapshot on an overlay and display this on top of my
interface.
3. On MouseMove, draw my rectangles on the overlay.
4. On MouseUp, remove the overlay.
This would make the rectangles part of my application and would
not constantly force Vista in and out of DirectX10.
I am not convinced that ControlPaint.DrawReversible...
is as appropriate today as it has been in the past. Also remember that
this method *only* draws on the desktop. If you need to draw such
rectangles on other device contexts, you have to implement it
yourself.
Any thoughts?
/Joergen Bech
On Thu, 26 Oct 2006 12:52:19 +0200, "Bob Powell [MVP]"
<bob@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Just use ControlPaint.DrawReversiblexxx. That draws directly on the desktop
and can draw outside of windows etc.
.
- Follow-Ups:
- Re: How to draw to the screen not the form?
- From: Bob Powell [MVP]
- Re: How to draw to the screen not the form?
- References:
- How to draw to the screen not the form?
- From: cheapguy
- Re: How to draw to the screen not the form?
- From: Bob Powell [MVP]
- How to draw to the screen not the form?
- Prev by Date: Question on graphic objects disposing
- Next by Date: Re: Question on graphic objects disposing
- Previous by thread: Re: How to draw to the screen not the form?
- Next by thread: Re: How to draw to the screen not the form?
- Index(es):
Relevant Pages
|