Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time resizing of textboxes 1

Status
Not open for further replies.

PC888

Programmer
Nov 7, 2003
117
CA
Has anyone tried to allow a run-time resizing of a textbox? Textboxes do not seem to have a property that allows run-time resizing. Any workarounds?
Many thanks.
 
To clarify what I really want to do, is to be able to grab the corner of the box with the mouse and resize it at run-time, just like what one can do at design time to resize the textbox.
 
it is possible but it needs a lot of code because you need to intercept the on mousedown and up events and a few others look in to custom usercontrols something like a drawing program would do much the same thing.


Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
actually it isnt all that much code.
found this on the codeproject website.

Code:
Dim _mouseDown as boolean = false


Private Sub Label1_MouseMove(ByVal sender As Object, _
  ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseMove

   If _mouseDown = True Then
      Label1.Width = e.X
   Else

      If e.X >= Label1.Width - 3 Then
         Label1.Cursor = Cursors.VSplit
      Else
         Label1.Cursor = Me.Cursor
      End If

   End If

End Sub

Private Sub Label1_MouseDown(ByVal sender As Object, _
  ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown

   _mouseDown = True
   Label1.Cursor = Cursors.VSplit
End Sub

Private Sub Label1_MouseUp(ByVal sender As Object, _
  ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseUp

   _mouseDown = False
   Label1.Cursor = Me.Cursor
End Sub

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Thanks Chrissie1. I tested it out and this is exactly what I am looking for. Bravo to you and the forum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top