Form Size Limitation?

Jarod

Well-known member
Joined
Feb 5, 2003
Messages
82
Location
Bruxelles
I have seen that Visual Studio.NET refuse to create (at design time) forms that are bigger than the resolution screen.
It is the same at runtime
And increasing the screen resolution will allow the creation of bigger forms.
However I wonder if there is a .NET limitation to forms size.
Any Idea?
Thanks,
 
Its probably not taking into account the form borders or something.
Anyway, why would you want to set the form larger than the screen?
That cant be a very good idea for a regular application, anyway. :-\

Still, it doesnt look like you can do it with .NET alone. You might
be able to do it with API. Try looking at the [api]SetWindowPos[/api] API.
 
What I want to do is to create a form of size 2048x768.
The client will lhave a PC with two screens used as a single one (multiscreen system).
So, I would like to be able to create my form of that size and design it correctly, without having such a resolution on my development computer...
 
Can you not design the form so that it is resizable. That way you can develop it at your resolution but the client can increase the form to fit their 2048x768 desktop. This will also make it flexible enough to work with other resolutions too.
 
My computer has two monitors, and it does allow me to resize
it larger than my main monitor. If I set the width and height to
8000x8000, then it goes just a little bit lower than the screen, and
it fills up both monitors. It just wont go bigger than both monitors
combined.
 
Maybe a related question:

I have a custom user control for entering DateTime Values.
This user control contrains a button which will popup a new form (modal) with a calendar on it. The position of the new "calendar-form" is determined via the position of the caller (my user control).

Now Id like to be able to compute, whether the popup calendar will be "on the screen". I know the logic - but I dont know how I can detect the relation the actual screen size.

Any ideas?
 
ok. problem solved.

Code:
    Public Shared Sub EnsureOnScreen(ByRef aControl As Control)

        Dim mainLeft As Integer
        Dim mainRight As Integer
        Dim mainTop As Integer
        Dim mainBottom As Integer

        Dim formLeft As Integer
        Dim formRight As Integer
        Dim formTop As Integer
        Dim formBottom As Integer

        Dim moveLeft As Integer
        Dim moveRight As Integer
        Dim moveUp As Integer
        Dim moveDown As Integer

        Dim upperLeft As Point
        Dim lowerRight As Point

        upperLeft = aControl.PointToScreen(New Point(0, 0))
        lowerRight = aControl.PointToScreen(New Point(aControl.Width, aControl.Height))

        formLeft = upperLeft.X
        formTop = upperLeft.Y
        formRight = lowerRight.X
        formBottom = lowerRight.Y

        mainLeft = 0
        mainTop = 0
        mainBottom = Screen.PrimaryScreen.Bounds.Bottom
        mainRight = Screen.PrimaryScreen.Bounds.Width

        If formLeft < mainLeft Then
            moveRight = mainLeft - formLeft
        End If

        If formRight > mainRight Then
            moveLeft = formRight - mainRight
        End If

        If formTop < mainTop Then
            moveDown = mainTop - formTop
        End If

        If formBottom > mainBottom Then
            moveUp = formBottom - mainBottom
        End If

        upperLeft = aControl.Location
        upperLeft.X = upperLeft.X - moveLeft + moveRight
        upperLeft.Y = upperLeft.Y + moveDown - moveUp
        aControl.Location = upperLeft

    End Sub

I know. Lengthy code.
But easy to grasp.
 
Alternatively:

Code:
    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim primaryBounds As Rectangle = Screen.PrimaryScreen.WorkingArea
        Dim formBounds As Rectangle = Me.Bounds

        If Not primaryBounds.Contains(formBounds) Then
            Bounds = Rectangle.Intersect(primaryBounds, formBounds)
        End If
    End Sub

This will also take accound of the taskbar space :)
 
Back
Top