Re: Mike D Sutton please need help....
- From: vonclausowitz@xxxxxxxxx
- Date: 24 Jun 2006 12:52:04 -0700
Mike,
I looked at the page but it is not exactly what I'm looking for.
I have a form with a PictureBox, an ImageList and an Image.
The ImageList holds the icons I want to show. THey are loaded into the
Image.
Then the image is displayed in a circle on the form. With one extra in
the middle of
the circle. The one in the middle of the circle should be connected
with all the others with
a rope.
I want to be able to drap all the icons into another position.
Ropes.Add NewRope(Boxes(1), Boxes(2), "Boss")
where Boxes(1) and (2) should be replaced with an icon and Boss is the
label text in the
middle of the rope (see my other post).
Public Sub Draw(obj As Form)
On Error Resume Next
obj.Line (A.x, A.y)-(B.x, B.y), vbBlack
obj.CurrentX = (A.x + B.x) \ 2 - (Len(Text) / 2)
obj.CurrentY = (A.y + B.y) \ 2
obj.Print Text;
End Sub
Private Sub MoveControls(Optional ByVal inOffset As Single = 0)
Dim LoadButtons As Long
Dim CircleWidth As Long, CircleHeight As Long
Dim ThisRad As Single
Const NumButtons As Long = 8 ' Number of buttons
Const Pi As Single = 3.14159
Const TwoPi As Single = Pi * 2
Const ButtonWidth As Long = 1000
Const ButtonHeight As Long = 1000
' Work out how much space we have to position the buttons
CircleWidth = (Me.ScaleWidth - ButtonWidth) \ 2
CircleHeight = (Me.ScaleHeight - ButtonHeight) \ 2
For LoadButtons = 0 To NumButtons - 1
If (LoadButtons >= Command1.Count) Then
Call Load(Command1(LoadButtons))
Command1(LoadButtons).Visible = True
Command1(LoadButtons).Picture =
Me.ImageList1.ListImages(1).Picture
End If
' Get the position of this button in radians
ThisRad = (LoadButtons / NumButtons) * TwoPi + inOffset
' Move this control to it's position around the circle
Call CentreControl(Command1(LoadButtons), _
(Cos(ThisRad) * CircleWidth) + (Me.ScaleWidth \ 2), _
(Sin(ThisRad) * CircleHeight) + (Me.ScaleHeight \ 2), _
ButtonWidth, ButtonHeight)
Next LoadButtons
End Sub
Marco
Mike D Sutton schreef:
You once helped me with a code to show icons on a form and connect them
to other icons in a circle with ropes and boxes. I have lost the code
and have only some parts of it recovered.
The only thing I could find in the newsgroups was this:
http://groups.google.nl/group/microsoft.public.vb.general.discussion/browse_frm/thread/c601dbb558b9f001/46fa069136a21625?lnk=st&q=LoadButtons+%3E%3D+Command1.Count&rnum=1&hl=nl#46fa069136a21625
I was hoping that you could help me out here.
Have a look at the "Best line between two rectangles" demo on my page for an example of how to draw the closest
connecting line between two rectangles. If you're using circles then you could use an easier method using the bounding
circle of the icon and Pythagoras theorem.
I don't recall the previous post so without more information there's a limit to what more help I can offer.
Hope this helps,
Mike
- Microsoft Visual Basic MVP -
E-Mail: EDais@xxxxxxxx
WWW: Http://EDais.mvps.org/
.
- Follow-Ups:
- Re: Mike D Sutton please need help....
- From: Mike D Sutton
- Re: Mike D Sutton please need help....
- References:
- Mike D Sutton please need help....
- From: vonclausowitz
- Re: Mike D Sutton please need help....
- From: Mike D Sutton
- Mike D Sutton please need help....
- Prev by Date: Re: calculate centerpoint on line?
- Next by Date: Re: calculate centerpoint on line?
- Previous by thread: Re: Mike D Sutton please need help....
- Next by thread: Re: Mike D Sutton please need help....
- Index(es):
Loading