Re: Mike D Sutton please need help....

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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/

.



Relevant Pages

  • Object-Oriented Programming (run-time polymorphism) with C99
    ... Shape is the base class and Circle is derived from Shape. ... // destructors void Point_destroy; ... unsigned int G; // green ... // representation const ...
    (comp.lang.c)
  • Re: [C++] Member function headache
    ... Does this change the Rectangle? ... So why not bool overlap(Rectangle const &) const = 0; ... > The problem is that when I have a rectangle class which has an overlap ... > funtion defined for circle, I have to define circle an overlap function for ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Mike D Sutton please need help....
    ... The second Question I have is how to load all these icons in a circle ... Dim CircleWidth As Long, CircleHeight As Long ... Const NumButtons As Long = 8 ' Number of buttons ... Private Sub Form_MouseDown(ByRef Button As Integer, ...
    (microsoft.public.vb.winapi.graphics)
  • Re: Liskov Substitution Principle and Abstract Factories
    ... class Positive: public Integer ... Positive (const Integer); ... >> is any fundamental between constraining to const and constraining to ... >> It would be silly to model circle as an independent type. ...
    (comp.object)
  • Re: Bitmaps for enhanced AutoComplete
    ... I like the idea with the circle. ... At the moment autocomplete does not diffrentiate between method paramaters and temp vars. ... I came up with an arrow that points back to itself for self. ... Although I'd love to use them I think that they neither provide exactly the visuals we need (same applies to VS icons) and do not match the visual style of Dolphin. ...
    (comp.lang.smalltalk.dolphin)