473,809 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Graphics and Double Buffering

Hello,

I am using the Paint event to draw graphics, but I am getting annoying flickering. Is there anyway to perform double-buffering?

I have looked at creating a bitmap, but is limited in what I can do with it.

Any ideas?

Thanks
Simon Jefferies
si***@cooltools online.co.uk

Nov 20 '05 #1
3 1194
Simon,
Include the following in your Form or Control's constructor.

' Stop the flicker
Me.SetStyle(Con trolStyles.User Paint, True)
Me.SetStyle(Con trolStyles.Doub leBuffer, True)
Me.SetStyle(Con trolStyles.AllP aintingInWmPain t, True)
Me.SetStyle(Con trolStyles.Resi zeRedraw, True)
Me.UpdateStyles ()

This needs to be in the class you are painting ON, which can be different
then the object where the paint handler is. I normally handle the Paint
event in the same class that I am painting on.

Hope this helps
Jay

"Simon Jefferies" <si***@cooltool sonline.co.uk> wrote in message
news:ON******** ******@TK2MSFTN GP11.phx.gbl...
Hello,

I am using the Paint event to draw graphics, but I am getting annoying
flickering. Is there anyway to perform double-buffering?

I have looked at creating a bitmap, but is limited in what I can do with it.

Any ideas?

Thanks
Simon Jefferies
si***@cooltools online.co.uk
Nov 20 '05 #2
"Simon Jefferies" <si***@cooltool sonline.co.uk> schrieb

I am using the Paint event to draw graphics, but I am getting
annoying flickering. Is there anyway to perform double-buffering?

I have looked at creating a bitmap, but is limited in what I can do
with it.

Any ideas?


Maybe somebody at
microsoft.publi c.dotnet.framew ork.drawing
can help you.

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Thanks very much,

Works, just great!

Simon

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:Oc******** *****@tk2msftng p13.phx.gbl...
Simon,
Include the following in your Form or Control's constructor.

' Stop the flicker
Me.SetStyle(Con trolStyles.User Paint, True)
Me.SetStyle(Con trolStyles.Doub leBuffer, True)
Me.SetStyle(Con trolStyles.AllP aintingInWmPain t, True)
Me.SetStyle(Con trolStyles.Resi zeRedraw, True)
Me.UpdateStyles ()

This needs to be in the class you are painting ON, which can be different
then the object where the paint handler is. I normally handle the Paint
event in the same class that I am painting on.

Hope this helps
Jay

"Simon Jefferies" <si***@cooltool sonline.co.uk> wrote in message
news:ON******** ******@TK2MSFTN GP11.phx.gbl...
Hello,

I am using the Paint event to draw graphics, but I am getting annoying
flickering. Is there anyway to perform double-buffering?

I have looked at creating a bitmap, but is limited in what I can do with it.
Any ideas?

Thanks
Simon Jefferies
si***@cooltools online.co.uk

Nov 20 '05 #4

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

Similar topics

12
2389
by: Sanjay | last post by:
hi, We are currently porting our project from VB6 to VB .NET. Earlier we used to make scale transformations on objects like pictureBox , forms etc.Now Such transformations are made on the graphics object of the form/pictureBox. Should It be better if make a graphics object from my pictureBox in load event handler of the form and store it as member variable of the form , make
0
1164
by: bullshark | last post by:
I have a C# application that manipulates images. The application provides the ability to pan around the images. Normally you can "grab" the image and move it around and it moves in real time with the mouse cursor. There is very low friction. It slides easily. My problem is that with larger images, it just turns to mud. Refreshing the image, or re-drawing a screenful take so long that trying to pan the image results in jumpy, jerky...
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 );...
7
2584
by: Peter Row | last post by:
Hi, I've started work on my own control some parts of which use standard controls, others I need to draw on my controls surface to get the display output I require, however.... I seem to be stupid or missing the point. I used DrawString( ) as a simple test but I cannot get it to work at all unless I handle my custom controls Paint event.
17
1444
by: Galen Somerville | last post by:
The following code just shows a small portion of the overall Graphics on my Sweep form. I set the Panel to a medium Grey color so it stands out on a Windows Grey screen. The first thing that should happen is it should be painted Black. It just stays medium Grey !!!! Any help would be appreciated. GalenS
11
9315
by: cty0000 | last post by:
I have some quiestion... I want to draw line,point,rectangles and etc... on the from So I code like this.. public update() { g = this.CreateGraphics(); g.FillRectangle(Brushes.White, x1, y1, x2, y2); }
11
1504
by: Peter Webb | last post by:
I previously asked about two problems I had with some graphics - the first was that when I drew animation to a picturebox it wouldn't display when the Form loaded. It was suggested to me by everyone that I stop using my own CreateGraphics calls, and override an OnPaint call to do this. As suggested, I created a custom control "drawBox" with an override on its OnPaint. Because I am using manual double buffering, as people suggested it was...
3
6133
by: Alexander Vasilevsky | last post by:
What paint faster than Graphics.Draw? http://www.alvas.net - Audio tools for C# and VB.Net developers + Christmas discount
0
9721
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
10640
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10387
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
10120
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...
1
7662
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
5550
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
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
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
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.