473,388 Members | 1,215 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,388 software developers and data experts.

A forms drawing problem

I have a window drawing problem that I hope someone may be able to
help with.

I basically have a form and a control in the form which is docked to
fill. I want to resize the form and get the docked control to resize
smoothly with the form. The problem is that the form and the control
are being painted separately. So you see the form resize and then the
docked control. Ideally I want them both to resize, paint to the
buffer and then draw to the screen.

I can not use manual painting as the control I am using I have no
access to the source code.

Does anyone have any suggestions as to how I might do this?
Jan 18 '08 #1
8 2013
On Jan 18, 9:29*am, Olie <owa...@gmail.comwrote:
I have a window drawing problem that I hope someone may be able to
help with.

I basically have a form and a control in the form which is docked to
fill. I want to resize the form and get the docked control to resize
smoothly with the form. The problem is that the form and the control
are being painted separately. So you see the form resize and then the
docked control. Ideally I want them both to resize, paint to the
buffer and then draw to the screen.

I can not use manual painting as the control I am using I have no
access to the source code.

Does anyone have any suggestions as to how I might do this?
Just how is the control "docked"? Using the Anchor property?
Jan 18 '08 #2
Dock = Fill
Jan 18 '08 #3
On Jan 18, 10:24*am, Olie <owa...@gmail.comwrote:
Dock = Fill
I personally have never used the Dock property, but I just ran a test
on a simple form with one listbox control that was set to Dock Fill.
When I resize the form, the listbox resizes virtually at the same time
the form does.

I am using VS2005.
Jan 18 '08 #4
>I personally have never used the Dock property

How do you live without this. It is one of the most useful properties
a Control has.
When I resize the form, the listbox resizes virtually at the same time
the form does.
Unfortunately virtually is not quite good enough for me. I need it to
appear smooth. This is a graphics app where the appearance is
important. Also you will find that as you increase the complexity of
the control it becomes more obvious.

Thanks for your help!

Jan 18 '08 #5
JS
Have you tried setting the Form's DoubleBuffered property to true?
Jan 18 '08 #6
Have you tried setting the Form's DoubleBuffered property to true?

Yes, thanks! I almost mentioned this in the post because I knew it
would come up. When you set double buffering it only double buffers
what is directly drawn to your form. It has no effect on the child
controls in the form.

Jan 18 '08 #7
On Jan 18, 11:06*am, Olie <owa...@gmail.comwrote:
I personally have never used the Dock property

How do you live without this. It is one of the most useful properties
a Control has.
I have never designed a form that had only one control on it and it
had to fill up the entire form.
>
When I resize the form, the listbox resizes virtually at the same time
the form does.

Unfortunately virtually is not quite good enough for me. I need it to
appear smooth. This is a graphics app where the appearance is
important. Also you will find that as you increase the complexity of
the control it becomes more obvious.

Thanks for your help!
You might try doing the resizing yourself in the Form_Resize event.
The .NET code may have unnecessary overhead that is slowing it down.
Jan 18 '08 #8
For graphics applications you should always:

Set the double buffering of the control on.

Set the ControlStyles to use UserPaint.

Override OnPaintBackground so that PaintBackground does not call the base
class.

Do your painting as efficiently as possible.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Olie" <ow****@gmail.comwrote in message
news:89**********************************@z17g2000 hsg.googlegroups.com...
>Have you tried setting the Form's DoubleBuffered property to true?

Yes, thanks! I almost mentioned this in the post because I knew it
would come up. When you set double buffering it only double buffers
what is directly drawn to your form. It has no effect on the child
controls in the form.
Jan 18 '08 #9

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

Similar topics

15
by: Wiktor Zychla | last post by:
today we've found a critical issue regarding the ListView from Windows.Forms. it was confirmed on several machines with Win2K and XP. here's the problem: create a ListView with about 50000 rows....
3
by: Joshua Russell | last post by:
Hi, Both the methods below open up a windows form called MasterForm. However, one works better than the other. Method 1 opens the form correctly but I don't have any reference to the instance of...
6
by: Ayende Rahien | last post by:
Excetremely annoying problem, I've an application with a long startup time. So I created another form with my logo in it to as a splash screen. The splash screen is run from another thread and is...
0
by: Hector | last post by:
I have a ComboBox set up in a non-modal form. When a selection is made from the ComboBox, the handler code closes the form, but then the system crashes because of an unhandled NullReferenceException....
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
15
by: Joshua Kendall | last post by:
I have a script in which it keeps opening the same form instead of only one instance. I also need help with a form that has a password. Where do I put the actual password? can I use a database for...
3
by: Lance | last post by:
I've noticed that controls that are contained in MDI child forms fail to raise MouseLeave events if the MDI child form's MdiParent property is set to Nothing (after it was set to an existing MDI...
3
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
6
by: dbuchanan | last post by:
I have a Windows Forms application that accesses SQL Server 2k from a small local network. The application has been used for weeks on other systmes but a new install on a new machine retruns...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
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: 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
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
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
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...

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.