elbielefeld, on 16 November 2010 - 09:40 AM, said:
What means no luck? Do you really mean "Visual Basic forms" or Windows Forms?
No luck means that it didn't work - using Windows forms within Visual Basic
It's Visual Studio, not Visual Basic. Visual Studio is the IDE where you do your development. Visual Basic is a programming language....maybe you have heard of it...it's commonly referred to as VB.Net.
I think the poster means that everything on the form should fit on the screen, no matter the resolution. If I have 30 controls on a form and I can see them all on 1280x1024, I should still be able to see all 30 controls if the resolution is set to 600x800.
I have this happening in my current project. We do not know what computer the project will run on. It could be a small screen or a touch screen or a huge monitor. I manually resize every control using percentages.
// section one
this.Width = Screen.PrimaryScreen.Bounds.Width;
this.Height = Screen.PrimaryScreen.Bounds.Height;
// section two
this.Width = Screen.PrimaryScreen.WorkingArea.Width;
this.Height = Screen.PrimaryScreen.WorkingArea.Height;
this.Location = new Point(0, 0);
Section one will cause the screen to fill the whole screen. Section two will fill the working area (ie it will not overlap the start menu). Then I set each button's Width, Height, and Location as a percentage based on the form's Width and Height. It is not easy, nor is it pretty, but it works.
Robin, that's one of the reasons I love silverlight/wpf is that by default, controls scale to fill their surrounding containers. So by setting margins, paddings, and alignments, you can create a form that is either static or stretchable, and all the controls stretch with it.
But from what I can tell, I don't think this is a question of scaling or layout. I think he's trying to resize the window to fit screen resolution. And my guess is that if the code provided didn't work, that code might not even be getting executed.
mjw85, please put a breakpoint on the line that you've inserted the provided code, and see if execution stops at that point. If it does, then you know at least that code is being executed.
Also, please remember to be detailed in your replies. We're not mind readers, and we're not personally invested in your project. We're just here because we like to help. But if you make that difficult, then we just move on to the next thread.