Resize Form and Detect Size In TextBox
Posted: Fri Jul 20, 2012 8:54 am
Got two textbox's one represents the form's width, and the another height.
When the form loads it displays the size of the form's width, and height in each textbox.
When you resize the form it'll automatically update the text in the texbox's and tell you what the form's current size is.
How can I do this?
EDIT:
I figured it out, here's the code for those that want to do the same.
When the form loads it displays the size of the form's width, and height in each textbox.
When you resize the form it'll automatically update the text in the texbox's and tell you what the form's current size is.
How can I do this?
EDIT:
I figured it out, here's the code for those that want to do the same.
Code: Select all
Private sizew As Integer
Private sizey As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = Me.Size.Width()
TextBox2.Text = Me.Size.Height()
End Sub
Private Sub Form1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
TextBox1.Text = Me.Size.Width()
TextBox2.Text = Me.Size.Height()
sizew = TextBox1.Text
sizey = TextBox2.Text
Me.Size = New System.Drawing.Size(sizew, sizey)
End Sub