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

How to change form size as screen dimentions chaged?

Hi,

I have one c# smart device application created in .net 2005. I have fixed size form for my one device.

Now i have another device and screen size is chaged menas it is more wider and short in size.
If i run same application then some of the controls are not visible as screen dimentions chages.

So, is there any way i can auto size my forms as per screen dimentions.

For exmple if i have screen dimensions like 251 X 300 it works fine
but if i have 300 X 340 it wont display my controls properly.

So, is there any method that automatically adjust my controls as screen dimensions chages.

Please, Can any one help me with this??
Dec 19 '08 #1
4 10357
Hello, I think you are talking about Window Base Application so in that matter you should set the AutoScale Property of Window Form. By Default It is Font but you can set as dpi. I think this will help you

Good Luck
Dec 19 '08 #2
Plater
7,872 Expert 4TB
I think admehta28 is refering to this:
this.AutoScaleMode = AutoScaleMode.Dpi
//this is the Form object you wish to change.

I don't know how to use it, or if its available to you on smart device applications.

You could consinder on startup of that form, checking what the size of the screen is, and making your adjustments mathmatically?
Dec 19 '08 #3
Hi Plater,

Actullay admehta28 is right Autoscale property is availble in framework 2.0 not in 1.0 and yes it is windows applicaiton.

I am using 1.0 framwork so i donot have that property.
So, basically what i was doing is calulating working area and my form size mathamatically, but i am not sure exectly how my all controls get adjust so that is why i put this questions.
for future details i can give u an example what i did.

Below my sample method:
Expand|Select|Wrap|Line Numbers
  1.  
  2. public static void ScaleDown(System.Windows.Forms.Form frm)
  3. {
  4.   int scrWidth = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;
  5.   int scrHeight = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;
  6.   if (scrWidth < frm.Width)
  7.   {
  8.         foreach (System.Windows.Forms.Control cntrl in frm.Controls)
  9.         {
  10.             cntrl.Width = ((cntrl.Width) * (scrWidth)) / (frm.Width);
  11.             cntrl.Left = ((cntrl.Left) * (scrWidth)) / (frm.Width);
  12.         }
  13.   }
  14.  
  15.   if (scrHeight < frm.Height)
  16.   {
  17.         foreach (System.Windows.Forms.Control cntrl in frm.Controls)
  18.         {
  19.             cntrl.Height = ((cntrl.Height) * (scrHeight)) / (frm.Height);
  20.             cntrl.Top = ((cntrl.Top) * (scrHeight)) / (frm.Height);
  21.         }
  22.     }
  23. }
  24.  
  25.  
But still some of the controls and form is not properly display


Any idea ??
Dec 19 '08 #4
Plater
7,872 Expert 4TB
Are any of your controls inside a "container" control, like a GroupBox or a Panel (or etc)?
Becase they would not get resized in the function you provided. You need to check to see if any of the controls also have controls
The function you have is the right idea I think though..
Dec 19 '08 #5

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

Similar topics

8
by: S.W. Rasmussen | last post by:
A trivial (?) question: does anyone know how to change the shape of the cursor in a RichTextBox control from the normal vertical line to an underscore?
9
by: Peter | last post by:
Hi at all, how can I do to make a css file to change automatically the text size of the text that is into a table relatively the screen size? I.E. if the screen is 800 x I want the text...
2
by: steve bull | last post by:
I would like my application to display the main form to cover the whole screen. At present I do this by calling Screen screen = Screen.PrimaryScreen; and setting the form size to this. The...
2
by: copyco | last post by:
Does anyone have any suggestions on this? I have a form that can be collapsed into a compact size and expanded back to full size. If the user moves the compact size of the form close to the edge,...
3
by: RG | last post by:
For a Windows project in VB.NET 2003: I need a Calendar that’s much larger than the MonthCalendar control in the toolbox; it needs to fill the whole screen (at least approximately ). VB...
1
by: Saso Zagoranski | last post by:
Hi, I've developed a Winforms application for a few people. It's a very basic Form with a few textboxes, comboboxes, buttons, labels and one PictureView. With 1024x768 screen resolution the...
14
by: Galen Somerville | last post by:
My current screen resolution is set to 1024 x 768. My form size always comes up as 1032 x 748. I have tried the help sample ' Retrieve the working rectangle from the Screen class ' using the...
1
by: Marc the Demi-Programmer | last post by:
I am overriding WncProc to make sure my form's location stays within specified parameters. Basically, it has to stay at the top of the screen and not be off to either of the sides. All that works...
1
by: roshina | last post by:
Hi Iam facing a problem in my project, developing a web site for online shopping in ASP on windows XP using IIS server. All the validations are ok but the new password is not upadated in the data...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.