473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 6483
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 OptimizedDoubleBuffer,
AllPaintingInWmPaint, 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.com

"Rain" <Ra**@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.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(graphics 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 OptimizedDoubleBuffer,
AllPaintingInWmPaint, 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.com

"Rain" <Ra**@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.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.com

"Rain" <Ra**@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Does the setStyle include the drawings(graphics 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 OptimizedDoubleBuffer,
AllPaintingInWmPaint, 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.com

"Rain" <Ra**@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.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.DoubleBuffered 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(ControlStyles.DoubleBuffer
| ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint) 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(graphics 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 OptimizedDoubleBuffer,
AllPaintingInWmPaint, 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.com

"Rain" <Ra**@discussions.microsoft.com> wrote in message
news:08**********************************@micros oft.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.DoubleBuffered 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(ControlStyles.DoubleBuffer
| ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint) 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(graphics 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 OptimizedDoubleBuffer,
AllPaintingInWmPaint, 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.com

"Rain" <Ra**@discussions.microsoft.com> wrote in message
news:08**********************************@micros oft.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.DoubleBuffered 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(ControlStyles.DoubleBuffer
| ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint) 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(graphics 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 OptimizedDoubleBuffer,
AllPaintingInWmPaint, 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.com

"Rain" <Ra**@discussions.microsoft.com> wrote in message
news:08**********************************@micr osoft.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 13 '05 #8

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

Similar topics

1
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...
17
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. ...
3
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...
2
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...
2
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...
1
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...
5
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...
21
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....
2
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.