473,799 Members | 3,146 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Resizing Form and Controls

79 New Member
Hello,

I am want to Resize my form and form controls based on the users resolution.

For example :- i am making this application in 1024x768. it obviously works and looks well too me but when my user runs this application on his pc it looks horrible and wierd because his Resolution is 800x600.

I found a snippet on this forum to resize the window but that just isn't what i'm looking for - i want the controls and form both to resize depending on the user resolution. Like if the user has a 800x600 and the app was made with 1024x768 it should automatically resize the form and its form controls to fit on the screen.

Could some one help me with this i am really lost :( in this form i also saw some one saying to use % sign to assign size to form and its elements but i tried this and it doesn't work :s it says its invalid.

I am using VB.net - Visual Studio 2005 - PLZ Help :(

Thank you,
Regards,
Sep 23 '08
14 2361
Plater
7,872 Recognized Expert Expert
The anchor property "anchors" your widget to the selected edge (top, bottom, left, right)

So if you put a widget 10px from the top and 3px from the left and have it sized to be 3px from the right, if you set it to anchor to left,top,right. No matter how you resize the form, it will always be that amount of px from those edges.
Just play with it and you'll see.
Sep 24 '08 #11
joedeene
583 Contributor
how about looking at this from microsoft ?

http://support.microsoft.com/kb/182070
Sep 24 '08 #12
Curtis Rutland
3,256 Recognized Expert Specialist
how about looking at this from microsoft ?

http://support.microsoft.com/kb/182070
Good article, but it looks to be for VB6, not VB.NET. Still, the logic may apply.
Sep 24 '08 #13
jg007
283 Contributor
Hi,

Thanks for all the help and support guys :)

Thanks for the code jg007, really appreciate it. - i can't seem to get it to work in my app.

I also can't understand Anchor property :( it just says left / top / right / bottom.

I have 1 TAB, 2 Buttons, 2 Panel, 2 Picture Box, 1 MultiLine Textbox, 1 Progressbar :(
the code was more of an example and should work if you create a new application with 3x buttons then just drop the code into one of them or the form load

I 'think' that resize code will be something like that and will just require some playing to get the maths right, at the moment my code just splits 3 buttons between the screen height making them each 33% of it and 50% the width but you could have a set of variables with the Value for 1% of the prefered size then just resize all the controls to this scaled to the current screen

sorry if that is a bit unclear and if I can I will work out some code then post it .
Sep 24 '08 #14
zubair1
79 New Member
Thanks for all the support :)

I will try to do more inDepth into Anchors, Platter :) thanks for pointing that out by reading it it seems very cool and just what i need but as you said i will have to play around with it for awhile.

i also came across a third-party library from Softgroup .NET Form Resizer

i'm thinking of using that too, not exactly sure yet though (it seems to be alittle slow - its not exactly how all the other normal applications resize).
Sep 26 '08 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1154
by: Tony | last post by:
Derived Forms resizing in dotnet. (Fix) Problem: If you have a form base class: public frmBase : System.Windows.Forms { public frmBase { // DefaultFormFont is new Font("Tahoma", 10);
11
18841
by: Jozef | last post by:
I have some old code that I use from the Access 95 Developers handbook. The code works very well, with the exception that it doesn't seem to recognize wide screens, and sizes tab controls so that they are too big and wind up covering up some of the fields on the main form. Is there any good code out there that works in a similar fashion that will also either a) stretch the form width wise on widescreens or b), rely on height rather than...
1
4886
by: Nikhil Patel | last post by:
Hi all, I dynamically create new controls and display them on the form. My problem is that the user has to resize form manually to see controls whose location property points to a point outside the form's area. So can you please show me a way to resize the form after adding a dynamic control so whose Location points to a point outside the form's boundary. So that the control can be displayed without resizing the form manually? Thanks...
2
3962
by: Vaughn | last post by:
Where can I get information on automatic resizing of controls when the form changes size (eg. if I dynamically increase the size of my form, the listview inside should automatically increase in size ). Thanks.
8
15048
by: Chris | last post by:
Hi, In design mode I built some windows with some controls (e.g. listboxes, labels, chgeck boxes etc.) in it, and I did set the property for the window size is set to normal. Now, when I run my app the first user's action is to maximize the window, but the controls inside the window are not resized simultaneously with my window, resulting in a real meshy window.
12
6736
by: Søren Reinke | last post by:
Hi there I have a little problem. How do i make sure that a graph is not redrawn while the form with the graph is being resized ? I have tried to add a mouse up/down event handler on the form1, but it dosn't get called when resizing :( I would like to be able to resize my form, but also make sure the graph is
4
6146
by: Thomas Richter | last post by:
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.
1
1723
by: Benz. | last post by:
Hello all, I'm having a very strange problem. I've an MDI application with many child forms. In 1 of my Child forms (Say frmA), I've a few design time controls. The forms Autoscroll property is TRUE. At runtime I dynamically generate a few other controls and place them at proper position according to my forms size. If I try to resize my MDI parent form OR move around to any different child form and return to this form after resizing i.e....
13
2512
by: Martin Ho | last post by:
I know this must be trivial for many of you. But I am playing with this and can't figure it out. I have a form, on that form is one panel which has 3 textboxes, when I run my program and maximize the form I want to resize my 3 text boxes according to the size of the form. Each text box should take 33% of the panel's width and full hight of the panel's height. Resizing of the panel is easy with docking... but these 3 textboxes are driving...
1
2715
by: =?Utf-8?B?U3RldmUgUmFuZGFsbA==?= | last post by:
I have a form with a number of panel controls on it. I have overriden the paint event (of the panel controls) to provide custom painting. What I have done is to use the Paint event to paint the background colour of a number of panel controls to be a gradient colour. This works fine. Is there a better way?? The problem I have is that when I resize the parent form I get alot of flickering as the paint events are constantly fired. I have...
0
9688
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10490
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
10260
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
10243
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10030
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7570
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
5467
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2941
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.