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



Mike,

I have been testing a bit and got following to work:

[class module Box]
Public i As StdPicture, x&, y&, Color&, Text$

Public Sub Draw(Obj As Form)
Obj.Line (x - 360, y - 360)-Step(720, 720), Color, B
Obj.Line (x - 360, y - 360)-Step(720, 720), vbBlack, B
Call Obj.PaintPicture(i, x, y)
Obj.CurrentX = x - (Len(Text) \ 2) * 100
Obj.CurrentY = y + 470
Obj.Print Text;
End Sub

[my form]

Boxes.Add NewBox(Me.ImageList1.ListImages(1).Picture, 1200, 500,
"JOHNSON, John", vbRed)

the different boxes are connected with ropes (line segments).
The problem is that I don't want a colored background, I just want the
icons connected with lines, however if I set all the backgrounds to
white (like the form) the move doesn't work any more since it looks for
the different colours.

Any idea how I can change this?

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As
Single, y As Single)
Dim i, c
Set User = Nothing
c = Point(x, y)
For Each i In Boxes
If c = i.Color Then Set User = i
Next
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As
Single, y As Single)
If Not User Is Nothing Then
User.x = x - 90
User.y = y - 90
Refresh
End If
End Sub

Marco

many thanks in advance..................................

Mike D Sutton schreef:

In the example you once gave me you created 4 boxes which were
connected by ropes (lines). These I could move around on the form.
<code snipped>
But now I want to have icons (in an image) that I want to connect to
eacht other with lines and be able to move them on the form.

Are you sure it was me who gave you the original code, it certainly doesn't look like mine (I never use the 'Step'
keyword, and very seldom use the Form over straight GDI hDC drawing) and the reference to 'rope' sounds like something
I'd remember..
In either case, it sounds to me like your box object needs to have an icon property of type StdPicture, which would be
drawn to the target form in its Draw method - You can use PaintPicture() for that.

Could you give me an example on how to do that?

I don't have any code offhand that would do exactly what you're asking for, the "Circle segment tracking" demo on my
site may give you some assistance on the clicking and dragging aspect of the problem though - the rest is easy.
Hope this helps,

Mike


- Microsoft Visual Basic MVP -
E-Mail: EDais@xxxxxxxx
WWW: Http://EDais.mvps.org/

.


Loading