2

i use Visual Studio 2010 and i want to have a form size 1280*1024 yet i can only have 1280*768. it seams VS2010 does not let me to have a form bigger then my supported screen resolution which is 1366*768 thus i cannot make a form bigger then 1366*768.

Question is: is there a way with VS2010 to have a size of form bigger then my screen resolution? (i know that we can make it on VS2008 but is there a way with VS2010 ? )

  • please dont ask me to change my graffic card its onboard
  • please dont ask me to uninstall VS2010 and install VS2008

anyother solutions beside these are welcome.

EDIT:

The problem is I cannot replace and put components in the right location since i cannot see the all space on Form1.cs [Design].

rumburak
  • 1,097
  • 11
  • 19
modest and cute girl
  • 785
  • 4
  • 13
  • 24

2 Answers2

5

You can use that if You need more space. This will create big panel with scrollbars. You cannot set the window size to be bigger then screen.

public Form1()
{
    InitializeComponent();
    this.AutoScroll = true;
    this.AutoSize = true;
    this.Controls.Add(new Panel() { Width = 2300, Height = 2000 });
    //this one will only set window size to size of screen
    this.ClientSize = new System.Drawing.Size(2300, 2000);
}

EDIT:

You can do the same thing in design. Just set form autoscroll to true, drop panel and set it size to huge. That will let You design Your huge panel with usage of scrollbars.

rumburak
  • 1,097
  • 11
  • 19
  • thanks rumburak for your answer. and your answer helped in some ways but not exactly. to explain more, it doesn't make your form screen bigger on the Form1.cs [Design] but makes the screen bigger with a scroll bar near when you run the program. but the problem is i cannot replace and put a components in the right location since i cannot see the all space on Form1.cs [Design]. – modest and cute girl Aug 09 '12 at 06:12
  • but You can do the same thing in design. Just set form autoscroll to true, drop panel and set it size to huge. That will let You design Your huge panel with usage of scrollbars. – rumburak Aug 09 '12 at 10:30
  • OK thanks now i managed to do that. im happy that people in here share their knowledge and enlighten each other. before i ask the question i searched about it and i haven't come with such an answer so your answer can help people who search about it also. so i accept your answer and you get 50 point as i offered rumburak. thanks. – modest and cute girl Aug 09 '12 at 12:29
  • by the way the problem with my visual studio was the size of the form remained constant and bounded by my screen resolution even i write the given code. but here is the key point -> after i drop a component, drop a panel to the farthest point then its size started to increase. so thats how i managed to do it with rumburak's answer and explanation. – modest and cute girl Aug 09 '12 at 13:04
  • check the right side of your profile page where reputations shows. your answer should be awarded and you should see it there. thanks again for the help. – modest and cute girl Aug 10 '12 at 04:44
1

Winforms will not let you create a window that's bigger than the monitor. No way to override it either. This is entirely reasonable, such a window isn't usable since there's no decent way for the user to get to the portions of the window that are outside of the monitor display area. Particularly vertical, moving the window by dragging the caption bar doesn't work.

The only way forward when you need 1280*1024 is to set the form's AutoSize property to True. Set the AutoScrollMinSize property to the size you need, Winforms automatically displays a vertical scrollbar on the form so the user can easily scroll to the parts of the window that are out of view.

If this is a specific design-time problem, in other words, when you are forced to design the form on a laptop but know that the user has a bigger monitor then you can fix it by forcing the size in code. Do so in the constructor (not the Load event), like this:

    public Form1() {
        InitializeComponent();
        this.Size = new Size(1280, 1024);
    }

But you never really know so don't skimp on using AutoScroll + AutoScrollMinSize.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • even i set the AutoSize property to True on the visual studio form properties panel, when i set the size property to 1280*1024 and hit enter key on keyboard it reduces automatically to 1280*788 :( it is not working as you say. or did i get you wrong? – modest and cute girl Aug 08 '12 at 21:57
  • I should have mentioned AutoScrollMinSize. Post updated. – Hans Passant Aug 08 '12 at 22:46
  • sorry but it doesn't help much. look at rumburak's answer it helps in some ways but not exactly. to explain it doesn't make your form screen bigger on the Form1.cs [Design] but makes the screen bigger with a scroll bar near when i run it. but the problem is i cannot replace and put my components in the right location since i cannot see the all space on Form1.cs [Design]. – modest and cute girl Aug 09 '12 at 06:10
  • It is getting very unclear what your real problem might be. Using AutoScroll works just fine at design time, you can scroll the form in the designer as well. If the meant "well, yeah, but your answer doesn't really help me, it still sucks to have to do this" then I can't help you, I won't buy a better monitor for you. Ask this guy if you can have his old ones: http://www.codinghorror.com/blog/2012/07/the-ips-lcd-revolution.html – Hans Passant Aug 09 '12 at 06:48
  • thanks a lot for replying and trying to help. now i managed to it. rumburak's answer worked. respect you and your knowledge also since you at 275k :) – modest and cute girl Aug 09 '12 at 12:34