resizing And Moving Controls At Run Time

  • Thread starter Thread starter Developer
  • Start date Start date
D

Developer

Hello All,
Is it possible to change the size of the text box (or any other control) on
a form at run time, by Drag and drop or resizing borders using the mouse
events. (Just like the design mode but the user will use it at run time on
form view).

Thanks in advance...
 
Developer said:
Is it possible to change the size of the text box (or any other control) on
a form at run time, by Drag and drop or resizing borders using the mouse
events. (Just like the design mode but the user will use it at run time on
form view).


The simple answer is yes. Here's some **simple minded**
code to give you the idea of how to adjust a text box's
width by dragging near the right boarder:

Private IsMoving As Boolean

Private Sub Text2_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
If X > Me.Text2.Width - 50 Then IsMoving = True
End Sub

Private Sub Text2_MouseMove(Button As Integer, Shift As
Integer, X As Single, Y As Single)
If IsMoving Then
If X < Me.InsideWidth - Me.Text2.Left _
And X > 500 Then
Me.Text2.Width = X
End If
End If
End Sub

Private Sub Text2_MouseUp(Button As Integer, Shift As
Integer, X As Single, Y As Single)
IsMoving = False
End Sub

BUT, real life is never simple! Especially if you want to
both move and resize. How do intend to distinguish moving
the text box from resizing the text box?
 
And more importantly, ***why*** do you want to allow your users to be able to
do this? Giving this type of control to users is indeed a slippery slope to
start down! Exactly what are you trying to accomplish?

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
Back
Top