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

Massive bug in WinForms 2

Why does WinForms in .NET 2 paint container controls more times than
necessary?

Steps to reproduce:

1. Make a UserControl called 'Widget'. Put some buttons / labels / etc
inside this control.

2. Make a UserControl called 'Container'. Place a bunch of 'Widget'
controls inside here.

3. Override the Contaner.OnPaint method and put a breakpoint on
base.OnPaint(e);

4. Start your application but make sure that your app window and IDE
window do not overlap (make IDE window very small and thin for
example). This is to prevent paint calls triggered by overlapping
windows.

5. Observe on the Container.OnPaint method get called after every LEAF
NODE control gets rendered. That means, Container.OnPaint gets called
when the widget gets painted, when the widgets labels/buttons get
painted, etc..

Aug 2 '06 #1
1 1087
sc*********@gmail.com wrote:
Why does WinForms in .NET 2 paint container controls more times than
necessary?

Steps to reproduce:

1. Make a UserControl called 'Widget'. Put some buttons / labels /
etc inside this control.

2. Make a UserControl called 'Container'. Place a bunch of 'Widget'
controls inside here.

3. Override the Contaner.OnPaint method and put a breakpoint on
base.OnPaint(e);

4. Start your application but make sure that your app window and IDE
window do not overlap (make IDE window very small and thin for
example). This is to prevent paint calls triggered by overlapping
windows.

5. Observe on the Container.OnPaint method get called after every
LEAF NODE control gets rendered. That means, Container.OnPaint gets
called when the widget gets painted, when the widgets labels/buttons
get painted, etc..
In a way, it's understandable: the widget control does an
InvalidateRect and by that gets a repaint, though that repaint causes
an invalidaterect of the container and thus that one gets a repaint as
well.

I do understand that they should have added some 2D clipping logic in
it so that if a topmost control performs an invalidate rect, the
container doesn't have to be repainted.

(though I now think that will go wrong if the topmost control is
transparent)

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Aug 2 '06 #2

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

Similar topics

12
by: nasht | last post by:
Hi, I'm trying to make a newsletter application in php (using mail() ). This application is supposed to look in a MySQL database and generate a list of emails and first names. Then it should...
1
by: | last post by:
Hi- I was curious if anyone has had good luck using one of the commercial .NET FTP client libraries to perform massive LIST commands. I have tried various free libraries with no/little success,...
4
by: Elhanan | last post by:
hi.. all a client of ours is considering to move from a dos application to windows desktop application. the application is for traveling agency, the database is rather large. their current...
5
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in...
1
by: Pieter | last post by:
Hi, In my application VB.NET 2005 application I placed a ReportViewer, and link it to a server-report: Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote...
4
by: 3Cooks | last post by:
I have a windows application written in Visual Basic 6.0 that is going to be redeveloped in dotNET. We are trying to decide if we should deploy using Webforms or Winforms and I need advice from...
0
by: netflex | last post by:
Working on a handed off C# project and pretty much my third time dipping into C#. In my solution file, I have a collection of .resx files in their own folder, several .cs files, and my winforms .cs...
5
by: brian.wilson4 | last post by:
Our group is currently comparing winforms vs webforms.....app is Corp LAN based - we have control of desktops.....Below is pros and cons list we have come up with - if anything strikes you as...
23
by: raylopez99 | last post by:
Here I am learning WinForms and two months into it I learn there's a WPF API that is coming out. Is this WPF out yet, and is it a threat to WinForms, in the sense that all the library routines I...
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: 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
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
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...
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
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...
0
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,...

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.