Results 1 to 5 of 5

Thread: user change textbox.width at run-time

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    80

    Question

    Hoi,

    On run-time I would like to have a textbox that can be modified by the user.
    Dragging the object to another place is possible, but how do I change the width and height?

    Fedor

    If swimming makes you slim, then what the hell is wrong with the whales?

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Cool

    This is a possibility:
    Assume you have your text box and a check box that, when checked, will allow your user to resize the text box in question. You could enable the resize any way you like. This is just a suggestion. When the check box is checked, the text box will resize to wherever the user clicks on the form.

    Code:
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
    If Check1.Value = vbChecked Then
        Text1.Width = Abs(X - Text1.Left)
        Text1.Height = Abs(Y - Text1.Top)
    End If
    
    End Sub

  3. #3
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276


    This gives a cool effect also:

    Code:
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
        If Button = vbLeftButton Then
            If X > Text1.Left And Y > Text1.Top Then
                Text1.Width = X - Text1.Left
                Text1.Height = Y - Text1.Top
            End If
        End If
    
    End Sub

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    80

    Thumbs up You Cool = True

    Thanks,

    this works almost like I had in mind, with some changes (in code or in thoughts) I will have exactly what I want, thanks !

    Fedor

  5. #5
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Smile

    You're welcome, Fedor. Glad to be of some help.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width