473,545 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2026
On Jan 18, 9:29*am, Olie <owa...@gmail.c omwrote:
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.c omwrote:
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.c omwrote:
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 OnPaintBackgrou nd 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.c omwrote in message
news:89******** *************** ***********@z17 g2000hsg.google groups.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
3846
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. now use task manager to see the GDI usage of the process. everything seems normal. now catch the ListView's scroller and start to move it...
3
2271
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 master form. Method 2 opens the form but when I right click on the Notify Icon I don't get the context menu that I should be seeing. I can interact with...
6
2535
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 communicated solely through static method and Invoke()'s However, when I close my second form, the first one (main window) is hiding under all the...
0
413
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. There is a reference to Unsafe Native Methods and Callback functions, but Interop Services are not used. What is going on ? The problem does not...
7
2460
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 each with a couple of controls in them I then rebuilt my project and my new panels and all controls they contained are gone... I've looked through...
15
2035
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 multiple users? opens multiple instances of password form instead of one: Public Class Splash Inherits System.Windows.Forms.Form
3
3197
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 container form) or if the MDI child form's Visible property is set to False (after the MDI child form was shown). This is an enormous problem for my app...
3
2358
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 get MyVarialble is not declared errors when the variable is quite clearly declared, when I change it to public and then back again to private the...
6
2557
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 errors. The machine is a new laptop Windows XP Pro SP2 The machine is up to date with respect to the dot net framework. Details: Dot Net Framework...
21
3297
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 a zipcode that is unknown this form will open. I don't want users to modify any of this customers data until they close the zipcode form. ...
0
7410
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...
0
7668
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. ...
1
7437
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...
0
7773
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...
0
5984
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5343
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...
0
4960
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...
0
3466
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...
1
1901
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

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.