473,698 Members | 2,177 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 6509
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
4454
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
12826
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
2979
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
15937
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
3456
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
3097
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
3470
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
7498
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
4013
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
8672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9021
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...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8860
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
7712
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...
0
4361
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3038
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

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.