473,405 Members | 2,210 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,405 software developers and data experts.

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(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.ResizeRedraw, true);
But it doesn't work.

Mit freundlichen Grüßen aus Kiel

Thomas Richter

--
ARIVA.DE AG, Thomas Richter, Diplominformatiker, 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 6088


"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(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.ResizeRedraw, 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("user32.dll")]

public static extern int ShowCaret(IntPtr hwnd);

[DllImport("user32.dll")]

public static extern int HideCaret(IntPtr hwnd);

public Carets()

{ }

}

}

use it as follows

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

//code that does all and whatever

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

its a little processor consuming but works great


Nov 17 '05 #3


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

//code that does all and whatever

Carets.ShowCaret(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.HideCaret(this.Handle); //beginning of the code block

//code that does all and whatever

Carets.ShowCaret(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
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...
5
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...
1
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
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...
3
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...
4
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...
0
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...
4
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...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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,...
0
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,...
0
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...
0
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...
0
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...

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.