[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 159
  • Last Modified:

how to resize

what i have ia text box and i want the  user to be able to resize it at run time. So if you position the mouse over the edge and left click and hold i want the movment of the mouse left and right to change the size of the box. any ideas
0
kplonk
Asked:
kplonk
  • 4
  • 3
  • 3
  • +1
1 Solution
 
tirupur_selvaCommented:
I think its quite difficult. But you can do it. You have to write the code in the Mousemove event. In the mousedown event you keep some flag and set it to true, if the mouse is pressed down at the edge. Then in the move event, you should proportionately increase the width and height of the text box.

I would suggest another easier method. You could place a slider bar and when the user moves the slider bar you can increase or decrease the size of the text box.
0
 
kplonkAuthor Commented:
hm interesting idea but is not the standard way to do it, thanks for the advice.
0
 
mcriderCommented:
Try this... If you use it, please reject the current answer and select this as the answer...


1) Start a new project.

2) Add a picturebox to Form1.

3) Add a textbox as a child of the picturebox.

4) Set the borderstyle of the picturebox to NONE.

5) Add the following code to the DECLARATION SECTION of form1:

    Private Sub Form_Load()
        Picture1_Resize
    End Sub
    Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = 1 Then
            Select Case Y
                Case 0 To Picture1.Height - 50
                    Picture1.Tag = "WE"
                Case Else
                    Picture1.Tag = "NS"
            End Select
        End If
    End Sub
    Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim lXY As Long
    On Error Resume Next
    Select Case Picture1.Tag
        Case "WE"
                    lXY = Picture1.Height
                    If Button = 1 Then
                        Picture1.Width = X
                        Picture1.Height = lXY
                    End If
        Case "NS"
                    lXY = Picture1.Width
                    If Button = 1 Then
                        Picture1.Height = Y
                        Picture1.Width = lXY
                    End If
        Case Else
            Select Case Y
                Case 0 To Picture1.Height - 50
                    Picture1.MousePointer = vbSizeWE
                Case Else
                    Picture1.MousePointer = vbSizeNS
            End Select
    End Select
    End Sub
    Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = 1 Then Picture1.Tag = ""
    End Sub
    Private Sub Picture1_Resize()
        On Error Resume Next
        Text1.Top = 0
        Text1.Left = 0
        Text1.Height = Picture1.Height - 40
        Text1.Width = Picture1.Width - 40
    End Sub
    Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Picture1.MousePointer = vbDefault
    End Sub



6) Run the program, and resize the textbox...


Hope this helps!


Cheers!
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
caraf_gCommented:
waty also did a very good one...

http://oldlook.experts-exchange.com/bin/Q.10118437
0
 
kplonkAuthor Commented:
sorry this is not that good thanks any way.
0
 
mcriderCommented:
Did you try my comment?

Cheers!
0
 
caraf_gCommented:
What! You call a code sample by waty "not that good"?

Heretic!!

(just kidding)
0
 
kplonkAuthor Commented:
ya man how the hell do i accept a comment as an answer to a question?
0
 
caraf_gCommented:
Check the "title bar" above the comment you want to accept. In there there's a hotlink for "accept comment as answer"
0
 
kplonkAuthor Commented:
nice
0
 
mcriderCommented:
Thanks for the points! Glad I could help!


Cheers!
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now