Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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,

Jarod
  • *Experts*
Posted

It's probably not taking into account the form borders or something.

Anyway, why would you want to set the form larger than the screen?

That can't be a very good idea for a regular application, anyway. :-\

 

Still, it doesn't 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.

Posted

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...

Jarod
Posted
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.

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

  • *Experts*
Posted

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 won't go bigger than both monitors

combined.

  • 3 months later...
Posted

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 I'd like to be able to compute, whether the popup calendar will be "on the screen". I know the logic - but I don't know how I can detect the relation the actual screen size.

 

Any ideas?

.nerd
Posted

ok. problem solved.

 

   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.

.nerd
  • *Gurus*
Posted

Alternatively:

 

   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 :)

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...