|
-
Oct 12th, 2005, 10:19 PM
#1
Thread Starter
Admodistrator
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
Its pretty easy, but really nice
-
Nov 3rd, 2005, 09:35 AM
#2
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.
-
Nov 3rd, 2005, 09:38 AM
#3
Frenzied Member
Re: Nice way to align controls (like vb.net does)
I've used it a couple of times.
Pretty slick...
Beantown Boy
Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
-
Nov 3rd, 2005, 05:37 PM
#4
Thread Starter
Admodistrator
Re: Nice way to align controls (like vb.net does)
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|