Windows Phone Developers

Showing posts with label VB.NET Resize Window Screen. Show all posts
Showing posts with label VB.NET Resize Window Screen. Show all posts

Tuesday, May 24, 2011

VB.NET How to Resize the form along with Controls

Windows Form - Resize Controls Dynamically using VB.NET

There would be many occasions you would have come across the need to resize the form to fit some controls/text etc. In the following example we use the combination of LinkLabel and Panel Control to achieve that

Here is the sample form

This is how it needs to be expanded to accomodate the additonal information

I have used a '+/-' hyperlink (LinkLabel Control) to resize the form. (For more info on Link Label : Hyperlink Control in Windows Forms (VB.NET) Application). You can use >> or << etc to be more clear

The controls for Year Founded and Financial Performance are enclosed in a Panel

Add the following code to the LinkClicked event of the LinkLabel

If Panel1.Height = 0 Then
            Panel1.Height = 110
            Me.Height = Me.Height + 110
        Else
            Panel1.Height = 0
            Me.Height = Me.Height - 110

        End If


The form gets re-sized on clicking the hyperlink (it actually toggles)

See also : How to Get Width and Height of Desktop Screen using C#/VB.NET Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Thursday, September 16, 2010

How to make Windows Form fit FullScreen using VB.NET

We have already seen How to Get Width and Height of Desktop Screen using C#/VB.NET in previous post. The following VB.NET snippet provides a method to make the Windows Form fir the Desktop screen

Dim iWidth As Integer = Screen.PrimaryScreen.Bounds.Width
        Dim iHeight As Integer = Screen.PrimaryScreen.Bounds.Height

        Me.Width = iWidth
        Me.Height = iHeight

        Me.Location = New System.Drawing.Point(0, 0)



You can add this snippet in Form_Load sub Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon