473,787 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Double BUffer

Hello Gurus!

I really need this one to finish a module in my thesis. PLease please help
me. I need a double buffer class so i can call it and use it anytime i want,
the problem is everything ive tried as a class doesnt work.. please please
help. I only need the double buffering of controls, graphics... as a class.
Can anyone help me with this? Thank You so so much in advacne. I would really
appreciate any help.
Dec 8 '05 #1
7 6515
Its in C# by the way..

"Rain" wrote:
Hello Gurus!

I really need this one to finish a module in my thesis. PLease please help
me. I need a double buffer class so i can call it and use it anytime i want,
the problem is everything ive tried as a class doesnt work.. please please
help. I only need the double buffering of controls, graphics... as a class.
Can anyone help me with this? Thank You so so much in advacne. I would really
appreciate any help.

Dec 8 '05 #2
Rain,

Double buffering of a custom control class can be added automatically.
You don't need to do this yourself. In the constructor of your class, call
the SetStyle method, setting the OptimizedDouble Buffer,
AllPaintingInWm Paint, and UserPaint flags to true. This will cause your
OnPaint method to be called, and the Paint event to not be called. All of
the control painting is left to you at that point.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Rain" <Ra**@discussio ns.microsoft.co m> wrote in message
news:08******** *************** ***********@mic rosoft.com...
Hello Gurus!

I really need this one to finish a module in my thesis. PLease please help
me. I need a double buffer class so i can call it and use it anytime i
want,
the problem is everything ive tried as a class doesnt work.. please please
help. I only need the double buffering of controls, graphics... as a
class.
Can anyone help me with this? Thank You so so much in advacne. I would
really
appreciate any help.

Dec 8 '05 #3
Does the setStyle include the drawings(graphi cs painting) or only the
controls? What i really wanted to do was make a class that can manually
handle double buffering but my problem is i always do my manual double
buffering inside a OnPaint and when i will make it as a class, im having a
hard time thinking how i should do it.. Thanks!

"Nicholas Paldino [.NET/C# MVP]" wrote:
Rain,

Double buffering of a custom control class can be added automatically.
You don't need to do this yourself. In the constructor of your class, call
the SetStyle method, setting the OptimizedDouble Buffer,
AllPaintingInWm Paint, and UserPaint flags to true. This will cause your
OnPaint method to be called, and the Paint event to not be called. All of
the control painting is left to you at that point.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Rain" <Ra**@discussio ns.microsoft.co m> wrote in message
news:08******** *************** ***********@mic rosoft.com...
Hello Gurus!

I really need this one to finish a module in my thesis. PLease please help
me. I need a double buffer class so i can call it and use it anytime i
want,
the problem is everything ive tried as a class doesnt work.. please please
help. I only need the double buffering of controls, graphics... as a
class.
Can anyone help me with this? Thank You so so much in advacne. I would
really
appreciate any help.


Dec 9 '05 #4
Rain,

I'm not positive, but I would guess that it handles the painting of your
window, and any other window that is a child of your window. I can't be
sure, but I can't imagine that it would use all of these double buffers for
child windows when you already have one double buffer for the parent.

It definitely will double buffer your calls to the various methods on
the Graphics class though.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Rain" <Ra**@discussio ns.microsoft.co m> wrote in message
news:89******** *************** ***********@mic rosoft.com...
Does the setStyle include the drawings(graphi cs painting) or only the
controls? What i really wanted to do was make a class that can manually
handle double buffering but my problem is i always do my manual double
buffering inside a OnPaint and when i will make it as a class, im having a
hard time thinking how i should do it.. Thanks!

"Nicholas Paldino [.NET/C# MVP]" wrote:
Rain,

Double buffering of a custom control class can be added
automatically.
You don't need to do this yourself. In the constructor of your class,
call
the SetStyle method, setting the OptimizedDouble Buffer,
AllPaintingInWm Paint, and UserPaint flags to true. This will cause your
OnPaint method to be called, and the Paint event to not be called. All
of
the control painting is left to you at that point.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Rain" <Ra**@discussio ns.microsoft.co m> wrote in message
news:08******** *************** ***********@mic rosoft.com...
> Hello Gurus!
>
> I really need this one to finish a module in my thesis. PLease please
> help
> me. I need a double buffer class so i can call it and use it anytime i
> want,
> the problem is everything ive tried as a class doesnt work.. please
> please
> help. I only need the double buffering of controls, graphics... as a
> class.
> Can anyone help me with this? Thank You so so much in advacne. I would
> really
> appreciate any help.


Dec 9 '05 #5
Hi,

1.) I'm not sure, but I think that in 2.0 it's recommended to use the
Control.DoubleB uffered property instead of SetStyles.

2.) The SetStyle or DoubleBuffered affects painting solely for the
Control it is applied to. In SWF, every single control has it's own
"surface" on which it paints itself (from the Win32 standpoint, it has
both WS_CLIPCHILDREN and WS_CLIPSIBLINGS ). This is one of the reasons
why SWF is so much slower than forms created using MFC or Win32
directly. In those happy times, we used the WS_CLIPxxx flags only to
reduce flicker on dynamically resizing forms, because it drags a lot of
unnecessary overhead to control painting.

3.) There is also the (almost undocumented) WS_EX_COMPOSITE window style
in XP / 2k3, but I have a strange feeling that it's undocumented because
they don't want you to use it - the implementation seems far from
complete and causes some weird things to happen, like caption buttons
not highlighting, etc. When the flag is applied to a top-level control
(form), it causes all controls on it to paint onto the same surface,
using double buffering, in the correct order. This way you don't need to
use DoubleBuffered/SetStyles at all, but you'll certainly need a number
of hacks to get it working right, if at all possible, and even then,
you're locked to the xp/2k3 platform.

4.) What do you expect from the doublebuffering class? The only common
use for doublebuffering is control painting, and there is either the
DoubleBuffered property for 2.0, or SetStyles(Contr olStyles.Double Buffer
| ControlStyles.U serPaint | ControlStyles.A llPaintingInWmP aint) for 1.1.

I hope that what I've written makes sense, and if not, i'll try to make
myself clearer :)

HTH,
Stefan

Rain wrote:
Does the setStyle include the drawings(graphi cs painting) or only the
controls? What i really wanted to do was make a class that can manually
handle double buffering but my problem is i always do my manual double
buffering inside a OnPaint and when i will make it as a class, im having a
hard time thinking how i should do it.. Thanks!

"Nicholas Paldino [.NET/C# MVP]" wrote:

Rain,

Double buffering of a custom control class can be added automatically.
You don't need to do this yourself. In the constructor of your class, call
the SetStyle method, setting the OptimizedDouble Buffer,
AllPaintingIn WmPaint, and UserPaint flags to true. This will cause your
OnPaint method to be called, and the Paint event to not be called. All of
the control painting is left to you at that point.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Rain" <Ra**@discussio ns.microsoft.co m> wrote in message
news:08****** *************** *************@m icrosoft.com...
Hello Gurus!

I really need this one to finish a module in my thesis. PLease please help
me. I need a double buffer class so i can call it and use it anytime i
want,
the problem is everything ive tried as a class doesnt work.. please please
help. I only need the double buffering of controls, graphics... as a
class.
Can anyone help me with this? Thank You so so much in advacne. I would
really
appreciate any help.


Dec 10 '05 #6
Thanks for all your reply. You all have been veryhelpful. One more thing
though.. Does the setStyle() inlcude all the double buffering of all the
child controls, graphics, parent controls? thank you so much!

"Stefan Simek" wrote:
Hi,

1.) I'm not sure, but I think that in 2.0 it's recommended to use the
Control.DoubleB uffered property instead of SetStyles.

2.) The SetStyle or DoubleBuffered affects painting solely for the
Control it is applied to. In SWF, every single control has it's own
"surface" on which it paints itself (from the Win32 standpoint, it has
both WS_CLIPCHILDREN and WS_CLIPSIBLINGS ). This is one of the reasons
why SWF is so much slower than forms created using MFC or Win32
directly. In those happy times, we used the WS_CLIPxxx flags only to
reduce flicker on dynamically resizing forms, because it drags a lot of
unnecessary overhead to control painting.

3.) There is also the (almost undocumented) WS_EX_COMPOSITE window style
in XP / 2k3, but I have a strange feeling that it's undocumented because
they don't want you to use it - the implementation seems far from
complete and causes some weird things to happen, like caption buttons
not highlighting, etc. When the flag is applied to a top-level control
(form), it causes all controls on it to paint onto the same surface,
using double buffering, in the correct order. This way you don't need to
use DoubleBuffered/SetStyles at all, but you'll certainly need a number
of hacks to get it working right, if at all possible, and even then,
you're locked to the xp/2k3 platform.

4.) What do you expect from the doublebuffering class? The only common
use for doublebuffering is control painting, and there is either the
DoubleBuffered property for 2.0, or SetStyles(Contr olStyles.Double Buffer
| ControlStyles.U serPaint | ControlStyles.A llPaintingInWmP aint) for 1.1.

I hope that what I've written makes sense, and if not, i'll try to make
myself clearer :)

HTH,
Stefan

Rain wrote:
Does the setStyle include the drawings(graphi cs painting) or only the
controls? What i really wanted to do was make a class that can manually
handle double buffering but my problem is i always do my manual double
buffering inside a OnPaint and when i will make it as a class, im having a
hard time thinking how i should do it.. Thanks!

"Nicholas Paldino [.NET/C# MVP]" wrote:

Rain,

Double buffering of a custom control class can be added automatically.
You don't need to do this yourself. In the constructor of your class, call
the SetStyle method, setting the OptimizedDouble Buffer,
AllPaintingIn WmPaint, and UserPaint flags to true. This will cause your
OnPaint method to be called, and the Paint event to not be called. All of
the control painting is left to you at that point.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Rain" <Ra**@discussio ns.microsoft.co m> wrote in message
news:08****** *************** *************@m icrosoft.com...

Hello Gurus!

I really need this one to finish a module in my thesis. PLease please help
me. I need a double buffer class so i can call it and use it anytime i
want,
the problem is everything ive tried as a class doesnt work.. please please
help. I only need the double buffering of controls, graphics... as a
class.
Can anyone help me with this? Thank You so so much in advacne. I would
really
appreciate any help.

Dec 12 '05 #7
No, it doesn't. As i've mentioned, every control is responsible for its
own drawing and parent can't affect how it's children are drawn, except
for the WS_EX_COMPOSITE flag.

Rain wrote:
Thanks for all your reply. You all have been veryhelpful. One more thing
though.. Does the setStyle() inlcude all the double buffering of all the
child controls, graphics, parent controls? thank you so much!

"Stefan Simek" wrote:

Hi,

1.) I'm not sure, but I think that in 2.0 it's recommended to use the
Control.Doubl eBuffered property instead of SetStyles.

2.) The SetStyle or DoubleBuffered affects painting solely for the
Control it is applied to. In SWF, every single control has it's own
"surface" on which it paints itself (from the Win32 standpoint, it has
both WS_CLIPCHILDREN and WS_CLIPSIBLINGS ). This is one of the reasons
why SWF is so much slower than forms created using MFC or Win32
directly. In those happy times, we used the WS_CLIPxxx flags only to
reduce flicker on dynamically resizing forms, because it drags a lot of
unnecessary overhead to control painting.

3.) There is also the (almost undocumented) WS_EX_COMPOSITE window style
in XP / 2k3, but I have a strange feeling that it's undocumented because
they don't want you to use it - the implementation seems far from
complete and causes some weird things to happen, like caption buttons
not highlighting, etc. When the flag is applied to a top-level control
(form), it causes all controls on it to paint onto the same surface,
using double buffering, in the correct order. This way you don't need to
use DoubleBuffered/SetStyles at all, but you'll certainly need a number
of hacks to get it working right, if at all possible, and even then,
you're locked to the xp/2k3 platform.

4.) What do you expect from the doublebuffering class? The only common
use for doublebuffering is control painting, and there is either the
DoubleBuffere d property for 2.0, or SetStyles(Contr olStyles.Double Buffer
| ControlStyles.U serPaint | ControlStyles.A llPaintingInWmP aint) for 1.1.

I hope that what I've written makes sense, and if not, i'll try to make
myself clearer :)

HTH,
Stefan

Rain wrote:
Does the setStyle include the drawings(graphi cs painting) or only the
controls? What i really wanted to do was make a class that can manually
handle double buffering but my problem is i always do my manual double
buffering inside a OnPaint and when i will make it as a class, im having a
hard time thinking how i should do it.. Thanks!

"Nicholas Paldino [.NET/C# MVP]" wrote:

Rain,

Double buffering of a custom control class can be added automatically.
You don't need to do this yourself. In the constructor of your class, call
the SetStyle method, setting the OptimizedDouble Buffer,
AllPainting InWmPaint, and UserPaint flags to true. This will cause your
OnPaint method to be called, and the Paint event to not be called. All of
the control painting is left to you at that point.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Rain" <Ra**@discussio ns.microsoft.co m> wrote in message
news:08**** *************** *************** @microsoft.com. ..
>Hello Gurus!
>
>I really need this one to finish a module in my thesis. PLease please help
>me. I need a double buffer class so i can call it and use it anytime i
>want,
>the problem is everything ive tried as a class doesnt work.. please please
>help. I only need the double buffering of controls, graphics... as a
>class.
>Can anyone help me with this? Thank You so so much in advacne. I would
>really
>apprecia te any help.

Dec 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4458
by: David | last post by:
Hello I'm writting an apllication and i like to display and offscreen image. However my code doesn't seem to work. It compiles and runs properly but What i want is to associate the button of the menu to switch an image (actually to add rectangels offscreen and bring it to the front). The following codes runs properly. You just need to create a file images.properties and put some images in a folder called images. By the way this is...
17
12863
by: Suzanne Vogel | last post by:
I'd like to convert a double to a binary representation. I can use the "&" bit operation with a bit mask to convert *non* float types to binary representations, but I can't use "&" on doubles. To get around this limitation on double, I'd like to keep the bits of the double the *same* but change its interpretation to long. I can use "&" on longs. I tried to use reinterpret_cast for this purpose, but it returned zero every time. double...
3
2985
by: Alex Glass | last post by:
I have read plenty about applying double buffering for animation and self drawn forms. Is there a way to apply it to a form with many standard controls on it (textboxes, labels etc) ?? I have tried using myForm.SetStyles(ControlStyles.DoubleBuffer, True) however it has made no impact on the drawing operation. Any clarification would be greatly appreciated -Alex
2
15945
by: MPowell | last post by:
Gents/Ladies, I'm doing (at least plan on ) lots of Reads and Writes across a communication channel. I'm told that for the 'receive side' it'd be prudent to implement a double buffering scheme to handle all the asnychronous inputs. Someone mentioned Herb Shutters book as frame of reference, nonetheless, could someone provide sample code or - in effect an outline of double buffering? I've perused the web but most references are to...
2
3463
by: Jason | last post by:
I have created a 2d isometric game map using tiles and now I'm trying to move around my map..when i go near the edge of the map I want to redraw the map to show new parts of the map however the screen flicker a good bit while this happens. I'm using GDI+ and it say in MSDN that double buffering will fix this but it didnt work for me. this.Setstyle(Controlstyles.DoubleBuffer, true ); this.Setstyle(Controlstyles.UserPaint, true );...
1
3106
by: Kuba Florczyk | last post by:
Hi I've got some problem doing double buffer. Here is my problem: I've got custom control on which i paint some data (chat messages, lets call it ChatControl), this control is puted on a scrollable panel. Of course i've set right styles on a ChatControl: //styles this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
5
3474
by: DBuss | last post by:
I'm trying to convert a binary data feed into something more friendly. Some of the data is Int (and extracts successfully), but some is Double and doesn't. The below line of code gives harsh compilier warnings and then doesn't work correctly. I don't understand the warnings, sizeof(double) = 8. An integer has size 4 and it works fine. // THIS Works!!! unsigned int x_int = buffer<<24 | buffer<<16 | buffer<<8 | buffer; // This Does...
21
7523
by: Aman JIANG | last post by:
hi I need to do this (convert double to string) fast, safe and portable. Is there any way to do this ? Except the ways following: 1. C++ I/O stream, stringstream (and boost::lexical_cast) 2. sprintf (and its brothers) 3. any nonstandard C/C++ functions
2
4017
by: barker7 | last post by:
I use a simple double array plus a variable to store the row size to represent two dimensional data. I need to quickly copy this data to a two dimensional array: double. Currently I iterate through the double, one by one and place it into the preallocated double. The arrays are large, and I'm doing a lot of these. Thus it has become a significant bottleneck. Can anyone suggest a faster way to convert a double + row size info to a...
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.