Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Resize controls and screen resolution independence without 3rd party controls....

Posted on 2007-04-04
10
Medium Priority
?
331 Views
Last Modified: 2013-11-26
I am looking for some help in figuring out the best way to resize our applications. Right now we use a 3rd party resize tool and would like to get away from it if possible.  After talking to Microsoft the other day about a unrelated problem he said that if was are using VS2005 that we dont need a 3rd party resize tool.  I'm attaching a little sample project with one form.  If you open it at 1024x768 and run the app you will notice that everything on the form shows up fine.  If you then drop your resolution down to 800x600 you will notice that it only shows about half of the form because the form didnt resize nor did the controls on the form resize.  Can someone show me in basic.net how to resize the form using docking and anchoring and autoscaling(all suggested by Microsoft) so that all the controls appear on the form just like they do in 1024 res.
0
Comment
Question by:pmac38CDS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 18851222
Hi pmac38CDS;

This is what Microsoft was talking about in this article. Talks about original support, VS 2002 & VS 2003 and current support VS 2005.  You also did not post a link to the project.

    http://msdn2.microsoft.com/en-us/library/ms229605.aspx

Fernando
0
 
LVL 1

Author Comment

by:pmac38CDS
ID: 18851264
I am trying to post the link now.  I always forget where it is that I have to go to upload a sample.
0
 
LVL 1

Author Comment

by:pmac38CDS
ID: 18851269
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 64

Expert Comment

by:Fernando Soto
ID: 18851306
Hi pmac38CDS;

This is the EE-Stuff web site to post uploads. Username and password is the same as the main EE web site.

http://www.ee-stuff.com/login.php

Fernando
0
 
LVL 1

Author Comment

by:pmac38CDS
ID: 18851556
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 18853739
Hi pmac38CDS;

I have not been able to make it work correctly. The following will cause you a problem. The form height is set to 721 pixels and the form can not be made bigger then the resolution of the screen. At 1024 x 768 it has a little space on the top and bottom of the form but when set to 800 x 600 the system automatically sets the height of the form at 600 pixels and does not display the bottom row of buttons. Even if you did something like the following in form load:

        If Screen.PrimaryScreen.Bounds.Width < 1024 Then
            Me.Scale(New SizeF(0.95F, 0.95F))
        End If

The form has already been resized before it gets to the form load and therefore shows a scaled down version with still no buttons on the bottom in view. The only way I have been able to get the whole form to be viewable is by doing the following:

        If Screen.PrimaryScreen.Bounds.Width < 1024 Then
            Me.AutoScroll = True
        End If

Which places scroll bars as needed and allowing you to scroll the row of buttons to come into view, This will take the whole screen. To make the form have some space around it at that resolution you can do the following in the form load.

        If Screen.PrimaryScreen.Bounds.Width < 1024 Then
            Me.AutoScroll = True
            Me.Scale(New SizeF(0.95F, 0.95F))
        End If

The Me.Scale will scale down the whole form to 95% of the original size when ran in a resolution lower then 1024 x 768.

Fernando
0
 
LVL 1

Author Comment

by:pmac38CDS
ID: 18858961
So none of the code resizes each control?  Not only do we want the form itself to look the same we also want each control to be resized to fit that resolution.  I played around with some of your code and no matter which resolution I was at, the buttons for instance seemed to stay the same size and never adjusted to which resolution it was in.  Right now we use Larcom and Youngs 3rd party resizer.  What we do is just add it to each form and then it resizes every control on that form to fit whatever resolution the client using our app is at.  The Microsoft guy said this could be accomplished also.  Is that right or am I missing something?
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 18860326
The following is from the Microsoft article:

An analogous situation occurs when an application is designed for a certain display resolution. The most common display resolution is 96 dots per inch (DPI), but higher resolution displays supporting 120, 133, 170, and above are becoming more common. Without adjustment, an application, especially a graphics-based one, designed for one resolution will appear either too large or too small when run at another resolution.

Automatic scaling seeks to ameliorate these problems by automatically resizing the form and its child controls according to the relative font size or display resolution. The Windows operating system supports automatic scaling of dialog boxes using a relative unit of measurement called dialog units. A dialog unit is based on the system font and its relationship to pixels can be determined though the Win32 SDK function GetDialogBaseUnits. When a user changes the theme used by Windows, all dialog boxes are automatically adjusted accordingly.

The above is talking about DPI as the resolution. Which means that a monitor set to 1024 x 768 with a DPI of 96 will display the same, without scaling, on a monitor of resolution 800 x 600 at a DPI of 96. What I believe would be the case is that if the program was developed on a system with a screen resolution of 1024 x 768 at a DPI setting of 133 and that program was run on a system with a screen resolution of 800 x 600 with a DPI setting of 96 then the form and all of its child control would scale. Which is not what you are looking for.

Fernando
0
 
LVL 1

Author Comment

by:pmac38CDS
ID: 18863617
So you are saying bascially that I have to stick with my 3rd party resizer to handle this for me?
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 1000 total points
ID: 18864238
In my opinion yes. They will scale if the two systems are of different DPI capabilities but not when the system was developed under 1 resolution such as 1024 x 768 and ran on another resolution such as 800 x 600.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question