|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
I have had no luck in finding code which can resize a label when the program is running. Using resizing arrows at the edge of the label. So I can change the size of the label to fit my needs. Is this possible? I have looked over alot of websites and cannot find a solution or tutorial. If it is possible could you possibly give me some pointers or snippets of code. (It has a border around a label. So it is easily seen.) Thanks In advance |
|
#2
|
|||
|
|||
|
Do you mean something else than setting the label property AutoSize to True
|
|
#3
|
|||
|
|||
|
Sorry for not being clear enough.
If I was to start the program, I want the ability of taking an edge of the label with the mouse and resizing the label to a smaller or larger size of my choice. Whenever you release the mouse it keeps the set size. |
|
#4
|
|||
|
|||
|
I don't think there is such a feature in a label. But you can try the mouse events for the label
Code:
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) |
|
#5
|
|||
|
|||
|
Thanks minor28 anyway.
I had a look at creating something out of the sub titles that you suggested. I tried. But I am just not experienced enough. I will find another way round my problem. But will be much more time consuming. If anyone can help me please drop a post. Thanks ![]() |
|
#6
|
|||
|
|||
|
I don't know another way round your problem. Don't give up. To start with you can change the mousepointer with this code example.
Code:
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Screen.MousePointer = vbSizeNWSE
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Y = 0 And X = Label1.Width / 2 Then Screen.MousePointer = vbSizeNS
End Sub
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Screen.MousePointer = vbDefault
End Sub
You have the pointer coordinates, you have the label position, height and width. When mousepointer is out of label control you have the same events for the form. |
|
#7
|
|||
|
|||
|
Been scratching my head for a while.
I still can't find anything to do with it on google. Your suggestion is a great starting point. Exactly the characteristics of what I need! I have been typing up some ideas but all seem to make no sense lol. I Will keep trying. |
|
#8
|
|||
|
|||
|
You should post your ideas. OK, I give you some more
Code:
Dim fmouse As Boolean
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
fmouse = True
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If fmouse = True Then
Screen.MousePointer = vbSizeNWSE
Label1.Width = x
Label1.Height = y
End If
End Sub
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If fmouse = True Then
fmouse = False
Screen.MousePointer = vbDefault
End If
End Sub
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Resizing a label? at runtime |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|