|
-
Mar 31st, 2006, 12:40 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] [2005] GDI drawing disappears with DoubleBuffer on
I have created my own control using GDI+. I have overriden the OnPaint event of the user control. The problem is there is a lot of flickering, so I added doublebuffering. But when I do that the control flashes info drawn with GDI flashed twice and disappears. What am I doing wrong?
-
Mar 31st, 2006, 01:01 PM
#2
Re: [2005] GDI drawing disappears with DoubleBuffer on
I've done loads of .net graphics now and I have never seen any evidence that the DoubleBuffer property does anything at all.
I say turn it off again and handle low level drawing yourself. This is easier than it sounds really although it is harder than VB6's AutoRedraw property...
Not sure how much you already know about backbuffering (the proper name for doublebuffering ) but basically it means tha you have an image hidden away in RAM tha is the same size as the dimensions of your control. The thing about this RAM buffer is that it never gets messed up by other forms getting in the way o anything like that.
The ram buffer is completely under your control. From your control's perspective all it has to do to implement backbuffering is to copy the ram buffer onto its own surface in it paint event. Thats it!
So if you want to (for example) draw a line on the control all you have to do is draw it onto the RAM buffer INSTEAD and then simply invalidate() the control and as if by magic you have persistent graphics.
If you want higher speed redrawing then you need to use control.SetStyle(...) to set a few flags in the control that determine how much control MS Windows has over your own drawing procedures. You need to set the UserPaint flag and a few others (i can't remember the names offhand, i'll get back to you if you PM me).
Last edited by wossname; Mar 31st, 2006 at 01:05 PM.
I don't live here any more.
-
Mar 31st, 2006, 01:09 PM
#3
Re: [2005] GDI drawing disappears with DoubleBuffer on
 Originally Posted by wossname
Not sure how much you already know about backbuffering (the proper name for doublebuffering  )
Proper name? Wouldn't the "proper name" be BitBlt?
-
Mar 31st, 2006, 01:36 PM
#4
Thread Starter
Frenzied Member
Re: [2005] GDI drawing disappears with DoubleBuffer on
Thanks for the info Woss, I think I found a good how to for dealing with the low level drawing. I'll try that out.
-
Mar 31st, 2006, 01:57 PM
#5
Frenzied Member
Re: [2005] GDI drawing disappears with DoubleBuffer on
Proper name? Wouldn't the "proper name" be BitBlt?
no, i dont think so
because the doublebuffer technique is about drawing all the things in memory before displaying the final version of the graphics once on screen ( that is how it prevents flickering while drawing several details on screen).
so according to this discription i think it is back buffereing than bitbilt
-
Mar 31st, 2006, 01:59 PM
#6
Re: [2005] GDI drawing disappears with DoubleBuffer on
 Originally Posted by maged
no, i dont think so
because the doublebuffer technique is about drawing all the things in memory before displaying the final version of the graphics once on screen ( that is how it prevents flickering while drawing several details on screen).
so according to this discription i think it is back buffereing than bitbilt 
Back buffering and double buffering are the same as BitBlit. They all draw everything off the screen and then load it onto the screen.
-
Mar 31st, 2006, 02:06 PM
#7
Frenzied Member
Re: [2005] GDI drawing disappears with DoubleBuffer on
yes i know,
we were just arguing about the proper name.
anyway i just answered to teaze him
-
Mar 31st, 2006, 02:09 PM
#8
Re: [2005] GDI drawing disappears with DoubleBuffer on
 Originally Posted by kasracer
Back buffering and double buffering are the same as BitBlit. They all draw everything off the screen and then load it onto the screen.
Kasracer, get a grip. BitBlt is the name of a Function in GDI. It means "Bit Block Transfer". It is often used during the backbufferig process but it is only PART of that process.
You can quite easily use BitBlt between 2 onscreen buffers, there is no reason to assume that BitBlt is only used for backbuffering. Thats like saying that a screwdriver is only ever used in building Ikea coffee tables.
mpdeglau, great I'm glad to help.
I don't live here any more.
-
Mar 31st, 2006, 02:03 PM
#9
Thread Starter
Frenzied Member
Re: [2005] GDI drawing disappears with DoubleBuffer on
It worked like a charm Woss. This is going to help me udles.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|