How can i make a Group consists of ;
- Imagebox
- Line
- Frame
where when i move the ImageBox, the line and frame move with it as its shadow.
[IMG][/IMG]
But remember; The Line is sizeable, i.e when you move the Frame, it pull the Line as a rope. as following Fig;
[IMG][/IMG]
So you want a movable box which, when you move it, a line and a frame 'shadow' it? Also, if you move the shadowing frame it will reposition the line?
If the box is moved by code, simply do something like this:
VB Code:
Dim DistX, DistY As Integer
DistX = Frame1.Left - Image1.Left
DistY = Frame1.Top - Image1.Top
'Move the box here
Line1.X1 = Image1.Left + Image1.Width
Line1.Y1 = Image1.Top + Image1.Height
Frame1.Left = Image1.Left + DistX
Frame1.Top = Image1.Top + DistY
Line1.X2 = Frame1.Left
Line1.Y2 = Frame1.Top
And as for moving the frame...
VB Code:
'Move the frame
Line1.X2 = Frame1.Left
Line1.Y2 = Frame1.Top
If you wanted to be able to drag and drop these items maybe someone else can fill that in for me, I'm not to sure on dragging and dropping objects because ... i never really had to before :P.
You know, this is what I love about these forums. Always new ideas and challenges. I wasn't totally clear on what you wanted. But the attached project should take care of at least half of your question.
What it does: When you drag the imageBox,then the frame will be dragged along if the ends of the line are a "MaxDist" away from each other. This variable is set in the module.
I wasn't sure what you wanted to happen when the frame is moved, so there isn't any code attached to the frame. I thought you might want to "lengthen the rope" but I wasn't sure. If so, it shouldn't be too difficult to add.
Keith_VB6
If you have any further questions, just ask.
If this solves things, then please mark the thread resolved.
[Thread Tools] --> [Mark Thread Resolved]
Uhhh ... sorry!
Also in the same example ;
What if i want to change the Frame Position , to the right or left or any position of the pictureBox ????????