I need a form wider than my screen in VB 2010

Posted on 2013-09-15
Medium Priority
Last Modified: 2013-09-24
I am writing a VB2010 program on a desktop computer with a 1280 X 1024 screen, but the program will run on a laptop with a 1900 X 900 screen.
I can enter 1900,900 in the forms max size property but the size property will not accept a width above 1300.
I need to place controls in the part of the form beyond 1300 in the designer window.
I have tried to change my screen resolution but 1280 X 1024 is as high as it will go.

Any suggestions (apart from buy a new screen)
Question by:BigOldDog
  • 2
LVL 40
ID: 39494215
You can't. It is stated clearly in the online documentation for the framework that the limit is the resolution of the screen on which the application runs (not the screen where it is designed). Even if you set it in the code, its reset at runtime.

I have a few solutions for you.

Buy a new monitor. The cost of decent 1920x1080 monitors is now around 150$ at Staples in Canada, thus probably lower in the states. If you count the cost of your time to use any of the other solutions, that is a steal. And since these types of definitions are now quite standard, expect to have other request like that one. Save yourself the trouble.

Create a resizable form. This is done through the Anchor property of the controls. You need to get used to the mechanism before you are comfortable with it, but it works quite well. You can design on your maximum definition, but the form will adjust itself if it is resized. You will find a lot of articles on how to use Anchor if you search for "Windows Form Anchor". This would be my preferred solution if buying another monitor is completely out of the question for you. You would not be stuck if the user eventually goes for a better screen or if the application needs to be run on another computer that does not have the 1900 resolution.

Some programmers put a Panel on a Form that has the AutotoScroll and AutoSize. They would set the Panel at the proper resolution, and then use the scroll bars on the form to design their thing. A Me.Width=1900 in the Form_Load event will enable the form to show correctly on your users's computer. But you will be stuck with the scrollbars when testing on yours and if the user tries to run on a lower definition computer.

Develop the application as a WPF Windows application. WPF has been designed for resizing, and will prepare you for eventual development on a mobile or a tablet environment, since the concepts it uses are the only one available to create screens in the new Windows 8 interface. The main problem here is that in order to facilitate the adaptation of the application to various screens and orientations WPF does not leave you has much possibilities as a Windows Form. It can be hard to use for very complex forms. And the learning curve is to consider.

Accepted Solution

BigOldDog earned 0 total points
ID: 39508225
Hi James

Thanks for your input.
But I was able to work out for myself that buying a new screen would solve the problem.
That is why the question specifically excluded this as an acceptable solution.

However the "problem" is really simple to solve.
I have set the form to
Autoscroll = True
Max size = 1900,900
Size = 1280,900 (the widest value my computer will accept)
Then position an invisible control, such as a label with no text, on the form and use its location property to position it at 1900,900.
Instantly I have a scrollable design environment of the required size.

It's so obvious I feel embarrassed that I ever asked the question in the first place

Author Closing Comment

ID: 39517289
The only solution offered was specifically excluded in the question. And the solution was so obvious I should not have asked the question in the first place

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Watch the video to know how one can repair corrupt Exchange OST file effortlessly and convert OST emails to MS Outlook PST file format by using Kernel for OST to PST converter tool. It can convert OST to MSG, MBOX, EML to access them. It can migrate…
From store locators to asset tracking and route optimization, learn how leading companies are using Google Maps APIs throughout the customer journey to increase checkout conversions, boost user engagement, and optimize order fulfillment. Powered …

607 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