Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
Hi everybody,
I am developing a windows application, in that i want to change the size of the application and all forms depends on the system resolution at runtime.Is der any way to solve this. so pls help me
Thanking you.
Posted

hi plz dont visit much site for it. u can do it easily by following following steps.
make form windows state maximized.
make a table flow from tool menu.
put it in a blank form.
make cells in the table flow.
put ur controls into that cells.
dock only those controls into the cell whose size u wanna resize.
set anchor properties of all controls none if u wanna set them at center at that position.
if u wanna set them at left or right size then set as u required.
dock table into form through dock property.
if u wanna set some proper format then make group box form controls u wanna put together.
set anchor of group box to none to make it at center.
if u having difficulty in cell arrangement then u can put more table into a cell.
u can do it easily just try it.
keep smile always n hit n try.
i did it by it.
thanks.
 
Share this answer
 
Thank u for ur reply, i wil try this dis and contact u if i face any pblm
 
Share this answer
 
You can set the form size on load according to the system resoulution.
Suppose you are creating a Form of size 300 X 300 in 1024 X 768 resolution, that means your form width is in the ratio of (300/1024)
and form height is in the ratio of (300/768). i.e.; you have to calculate the width and height by (300/1024) * Resolution.Width , (300/768) * Resolution.Height.

Getting the current resolution by the following code

MIDL
int sHeight = Screen.PrimaryScreen.Bounds.Height;
 int sWidth = Screen.PrimaryScreen.Bounds.Width;


Now you can calculate the form size by

Width = (yourDesiredFormWidth/YourCurrentScrResolutionWidth) * sWidth;
Height = (yourDesiredFormHeight/YourCurrentScrResolutionHeight) * sHeight;


Here YourCurrentScrResolutionWidth and YourCurrentScrResolutionHeight are the constatnts i.e.;1024 and 768 if your current resolution is 1024 X 768.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900