Nice way to align controls (like vb.net does)
If you are making a program, in which you want to user to be able to change the interface after runtime..this simple code might be of use:
Add two lines to your project, line 1 and line 2
VB Code:
Private Sub Cmd_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Static iX As Single
Static iY As Single
If (Button = vbLeftButton) Then
X = (X - iX)
Y = (Y - iY)
Cmd(Index).Move (Cmd(Index).Left + X), _
(Cmd(Index).Top + Y)
With Line1
.X1 = 0
.X2 = Me.Left + Me.Width
.Y1 = Cmd(Index).Top
.Y2 = Cmd(Index).Top
End With
With Line2
.X1 = Cmd(Index).Left + Cmd(Index).Width
.X2 = .X1
.Y1 = 0
.Y2 = Me.Top + Me.Height
End With
Else
iX = X
iY = Y
End If
End Sub
This way, while the users moves the button, the lines will show them whats aligned or not :wave:
Its pretty easy, but really nice
Re: Nice way to align controls (like vb.net does)
I used a slightly modified version of this the other day and it worked pretty well.
Re: Nice way to align controls (like vb.net does)
I've used it a couple of times.
Pretty slick...:thumb:
Re: Nice way to align controls (like vb.net does)