473,654 Members | 3,184 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

black flicker when resizing

Hi,
I can't get of the black flicker when I resize my form.
this = Mainform : System.Windows. Forms.Form
If I set the size from 300 to 500 I see for ca 500ms some
black areas. I try to solve it with:
this.SetStyle(C ontrolStyles.Do ubleBuffer, true);
this.SetStyle(C ontrolStyles.Us erPaint, true);
this.SetStyle(C ontrolStyles.Al lPaintingInWmPa int, true);
this.SetStyle(C ontrolStyles.Re sizeRedraw, true);
But it doesn't work.

Mit freundlichen Grüßen aus Kiel

Thomas Richter

--
ARIVA.DE AG, Thomas Richter, Diplominformati ker, Entwickler
Ostseekai 2, 24103 Kiel
Tel. (+49) 0431 97108-27, Fax. (+49) 0431 97108-29
E-Mail: tr@ariva.de, Web: www.ariva.de
Nov 17 '05 #1
4 6129


"Thomas Richter" wrote:
Hi,
I can't get of the black flicker when I resize my form.
this = Mainform : System.Windows. Forms.Form
If I set the size from 300 to 500 I see for ca 500ms some
black areas. I try to solve it with:
this.SetStyle(C ontrolStyles.Do ubleBuffer, true);
this.SetStyle(C ontrolStyles.Us erPaint, true);
this.SetStyle(C ontrolStyles.Al lPaintingInWmPa int, true);
this.SetStyle(C ontrolStyles.Re sizeRedraw, true);
But it doesn't work.


That's because it doesn't do what you'd intuitively think it does.

What I assume you're thinking that does is the following

Create temp buffer.
Draw form and all controls in buffer
Copy buffer to screen

What's actaully happening is the following:

Create temp buffer
Draw form (without any controls) in buffer
Copy buffer to screen
Draw controls directly to screen

Unfortunately afaik there's no way to draw the form and all the controls it
contains in an offscreen buffer without writing all the paint code yourself.

If you're doing any manual resizing in the Resize or SizeChanged event
handlers try to reduce it as much as possible using anchoring and auto
resizing to do as much of the work as possible, it's much faster and
consequently smoother than trying to do the work yourself. In a recent
project I managed to work out ~80% (subjective) of the redraw flicker by
spending a day toying with the automatic resize functionality to reduce the
ammount of manual intervention needed.
Nov 17 '05 #2
I have managed to reduce a lot of flick on my gui which if made of bitmaps
and other graphics by using caret class here

using System;

using System.Runtime. InteropServices ;

namespace WACLIENT

{

/// <summary>

/// Summary description for Carets.

/// </summary>

public class Carets

{

[DllImport("user 32.dll")]

public static extern int ShowCaret(IntPt r hwnd);

[DllImport("user 32.dll")]

public static extern int HideCaret(IntPt r hwnd);

public Carets()

{ }

}

}

use it as follows

Carets.HideCare t(this.Handle); //beginning of the code block

//code that does all and whatever

Carets.ShowCare t(this.Handle); //end of the code block

its a little processor consuming but works great


Nov 17 '05 #3


"Raj Chudasama" wrote:
Carets.HideCare t(this.Handle); //beginning of the code block

//code that does all and whatever

Carets.ShowCare t(this.Handle); //end of the code block


Just for clarification, this's supposed to be wrapping the manual
resize/layout code correct?

I'll give it a test tomorrow, since my flickering dialog does contain a fair
number of small bitmaps embedded in listviews.
Nov 17 '05 #4


"Dan Neely" wrote:


"Raj Chudasama" wrote:
Carets.HideCare t(this.Handle); //beginning of the code block

//code that does all and whatever

Carets.ShowCare t(this.Handle); //end of the code block


Just for clarification, this's supposed to be wrapping the manual
resize/layout code correct?

I'll give it a test tomorrow, since my flickering dialog does contain a fair
number of small bitmaps embedded in listviews.


I tried wrapping the form resize code with the caret calls but don't see any
difference. On my dev laptop the listview with the bitmaps flickers at the
edge of perception, and several text controls painted afterwards do flicker
annoyingly.
Nov 17 '05 #5

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

Similar topics

4
3863
by: Marek Mänd | last post by:
This seems an IE issue only: 4253 bytes testcase: http://www.hot.ee/idaliiga/testcases/ieselect/bnlinkingselectinmsie.htm Can one have 1) a mouseover/mouseout element on TBODY 2) change in thoise event handler background colors 3) have a specified heighted SELECT element, that doesnt flicker when the event handlers are get called.
5
4565
by: Michael C | last post by:
Hi all, I'm designing a C# app (VS.NET 2003) with an interface similar in design to Outlook. I get a lot of 'flicker' when I resize the main form. Anyone have any quick tips on how to reduce flicker when resizing a form? Thanks in advance, Michael C.
1
2747
by: Barguast | last post by:
Does anyone know how to stop or reduce the flicker caused by resizing an XP-style GroupBox control? (By which I mean FlatStyle set to System and visual styles enabled) Thanks.
1
2121
by: Ron Vecchi | last post by:
I am using asp.net to upload an image and then perform resizing on it and saving the different sizes to file. The resized images were coming up and being displayed in the bowser fine but the image sizes are a lot bigger(in file size) than the actual image being uploaded. The actual image being uploaded was around 22000bytes The smaller resized image is 120000bytes Also on the web when the resized image is displayed it starts out with a...
3
3520
by: Per Dunberg | last post by:
Hi all, I have to develop a "skinned" application and I have a problem with the graphics. When a form is loaded and displayed there's aways a flicker where all the controls are located on the form. It seems like the controls erase the background and this cause a flicker everytime a form i loaded. When I hide and show forms that are already loaded there's no flicker, it's just when the form is loaded the first time.
4
6787
by: Sarika | last post by:
I migrated a VB6.0 application to VB.NET. This app has a drawing area, which is a panel. The user can drag and drop several objects on this drawing area and can also draw lines, boxes etc. The app is sufferring from the problem of flicker. On reading several posts on this forum and others I decided to enable double buffering for my panel. However the drawing area appears blank. I can briefly see the objects when adding new objects on the...
0
2932
by: Sq | last post by:
I am having trouble with flickering of anything drawn on the splitContainer panels during resizing. I have overriden the control and used all the SetStyle settings for double buffering and this did not help. I think the problem is in the panels. They are being erased to the background color before the panel is painted. I cannot overide the panels as they are sealed. I would like assess to the windows message WM_ERASEBACKGROUND just like...
4
10753
by: Frank Rizzo | last post by:
Hello, I inherited a large Winforms project that is suffering from excessive flicker when switching between portions of the application. I've noticed that most parts of the application (user controls and forms) have DoubleBuffered set to true. In addition to that, in the constructor of every form and user control, there is this line: SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
0
8290
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
8815
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...
0
8708
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
6161
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
5622
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
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2716
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
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1596
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.