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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 Posts
Posts
 
 

No comments:
Post a Comment