![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I need some code (VB or C#) that will draw a series of rectangles (unfilled) to the screen's area, not a form or window area. I am trying to simulate a technique I have seen when a new window opens, a series of ever-larger rectangles are drawn to give a dynamic confirmation that the form is opening. The rectangles increase in size until they have reached the size of the form being opened, then the form is finally displayed and the rectangles are removed. I want to add this to an application I am writing so that when a form is opened, this dynamic feedback will be shown. In order to do this, I have to be able to draw the rectangles to the screen, not the current form since the form that is about to be opened can be well outside the boundaries of the parent form. Does anyone know how to do this? |
#3
| |||
| |||
|
|
I need some code (VB or C#) that will draw a series of rectangles (unfilled) to the screen's area, not a form or window area. I am trying to simulate a technique I have seen when a new window opens, a series of ever-larger rectangles are drawn to give a dynamic confirmation that the form is opening. The rectangles increase in size until they have reached the size of the form being opened, then the form is finally displayed and the rectangles are removed. I want to add this to an application I am writing so that when a form is opened, this dynamic feedback will be shown. In order to do this, I have to be able to draw the rectangles to the screen, not the current form since the form that is about to be opened can be well outside the boundaries of the parent form. Does anyone know how to do this? |
#4
| |||
| |||
|
|
Just use ControlPaint.DrawReversiblexxx. That draws directly on the desktop and can draw outside of windows etc. |
#5
| |||
| |||
|
|
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...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 (AT) _spamkiller_ (DOT) bobpowell.net> wrote: Just use ControlPaint.DrawReversiblexxx. That draws directly on the desktop and can draw outside of windows etc. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |