473,569 Members | 2,834 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Centering a form regardless of screen sizes?

1 New Member
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 1575
willakawill
1,646 Top Contributor
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 Recognized Expert Expert
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
2579
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 should I put into the stylesheet so that, no matter what resolution the viewer's screen is set to, the layout is always displayed centered ? Erik Schulp
5
1203
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 do that ? I am using grid layout. Please advice. San
5
1195
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 find those old properties in VB 2003.NET // Peter
1
2714
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 with bigger screen size. I'm trying to build a hospitality touch screen application w/ Window forms. However I am getting a bit flustered with...
2
2632
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 doesn't seem to recognize this HTML attribute. Can someone tell me how to do this?
8
4227
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 in Internet Explorer. What's odd is that it works on my site's home page and most other pages, but not on pages that I am returning from a...
5
4810
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 doing this demo with tables. The main problems are the vertical centering of the info area, and of the text inside the squares.
2
1374
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 forms in the Forms Editor on my widescreen laptop that has a lower height resolution than the destination PC. VB crops my form to the laptop screen size...
3
4298
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 frmConfig = new ConfigForm(this); frmConfig.MdiParent = this; frmConfig.TopLevel = false; frmConfig.StartPosition = FormStartPosition.CenterParent;
0
7693
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...
0
8118
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...
0
7962
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...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
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...
0
3651
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...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
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...

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.