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

Centering a form regardless of screen sizes?

1
I've written a program using a number of forms which runs perfectly on a 14" screen and you know the story....... on a bigger screen it all sits up in the top left hand corner.
Ok I can scale it to fit in the middle and still look like a 14" program running in a bigger screen which is fine too. But then when going back to the smaller monitor, its not all there...... Meaning the right hand side and bottom are off the screen until moved to fit in.
This is a very general question and if what I'm about to write here could solve my problem, I'd be laughing.............

Sub Form_Load ( ) Or Sub Form_Resize ( )
"If screensize > 14" Then Let Width = ScreenWidth * .80
Height = ScreenHeight * .78
Left = (Screen.Width - Width) / 2
Top = (Screen.Height - Height) / 2
end sub

I'm sure you can see that what this is doing, is simply centering (on a larger monitor) what appears as the full screen on a smaller monitor.... I'd prefer it to sit in the centre of a larger monitor but given the fact that smaller still exist, I feel that unless I can come up with some magic code (as above?), then its destined to always remain up in the top left hand corner.
Any suggestions please and thanks if so.
Dec 29 '06 #1
2 1565
willakawill
1,646 1GB
Hi. In design mode go to the properties window for the form and set StartUpPosition to 2-CenterScreen
Dec 29 '06 #2
Killer42
8,435 Expert 8TB
I see willakawill has provided a solution. However, I just wanted to point out that you can interrogate the screen size (resolution, anyway) by accessing Screen.Width and Screen.Height.
Dec 31 '06 #3

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

Similar topics

7
by: Erik Schulp | last post by:
Hi all, I am trying to get a CSS defined layout to center on the page, have tried doing this with the <center></center> tags but than everything is centered, including text etc etc. What...
5
by: San Ramon | last post by:
I am developing ASP.Net application using VB using VS.2003. I have more than 100 ASP server controls on the form. It is taking lot of time to position them on the screen. Is there any easy way to...
5
by: peter hansen | last post by:
In old Visual BASIC 6-days it was possible to set the Left and Top-property of a Form and put it into the center of the screen by using the Screen.Left, Screen.Width, Top and Height. Where do I...
1
by: MikeY | last post by:
Hi Everyone, I'm looking for suggestions for touch screen form sizes. Or better yet dealing with forms very various screen sizes. How to deal with anchoring buttons etc and so they don't overlap...
2
by: Joe Delphi | last post by:
Hi, I want to position label text so that it always appears centered when the user re-sizes the browser window. I tried adding the HTML property text-align="CENTER" to the code, but ASP.NET...
8
by: speralta | last post by:
I'm playing around with a test page that uses a <div id="main"within the context of a body with a width of 100% to center a fixed width field on a page. For some reason, the page is not centering...
5
by: Markus Ernst | last post by:
Hello This is a test example: http://www.markusernst.ch/anthracite/ http://www.markusernst.ch/anthracite/living_divani.html After googling and experimenting for several hours, I ended up...
2
by: Lennart Nielsen | last post by:
I'm writing an application for a specific screen size for a project. It works fine on my desktop at work, but when I try to tele-commute via VPN & Remote Descktop I can only access part of the...
3
by: Peted | last post by:
I have a simple c# app that opens a child form in a mdi parent. I want the child form to open in the center of the mdi parent, so i can open the child form ok, it all works fine, but setting ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
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,...
0
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...
0
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,...
0
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...
0
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...

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.