Results 1 to 8 of 8

Thread: How Can i make this simple Group?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2006
    Posts
    22

    Smile How Can i make this simple Group?

    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]

  2. #2
    Lively Member
    Join Date
    Oct 2004
    Posts
    91

    Re: How Can i make this simple Group?

    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:
    1. Dim DistX, DistY As Integer
    2. DistX = Frame1.Left - Image1.Left
    3. DistY = Frame1.Top - Image1.Top
    4.  
    5. 'Move the box here
    6.  
    7. Line1.X1 = Image1.Left + Image1.Width
    8. Line1.Y1 = Image1.Top + Image1.Height
    9. Frame1.Left = Image1.Left + DistX
    10. Frame1.Top = Image1.Top + DistY
    11. Line1.X2 = Frame1.Left
    12. Line1.Y2 = Frame1.Top

    And as for moving the frame...

    VB Code:
    1. 'Move the frame
    2.  
    3. Line1.X2 = Frame1.Left
    4. 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.

  3. #3
    Addicted Member
    Join Date
    Apr 2006
    Location
    USA
    Posts
    207

    Re: How Can i make this simple Group?

    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.
    Attached Files Attached Files
    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]

  4. #4

    Thread Starter
    Junior Member
    Join Date
    May 2006
    Posts
    22

    Thumbs up Thank you my Friends

    Thank You Very Much Cool Guys about your Great Answer.... because this Code was about to make me Crazy really


    Greeeat Thankss for Captains Josh Cool Jop Keith

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2006
    Posts
    22

    Re: How Can i make this simple Group?

    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 ????????

  6. #6
    Addicted Member
    Join Date
    Apr 2006
    Location
    USA
    Posts
    207

    Re: How Can i make this simple Group?

    Just use the same code in the image Mouse_down and Mouse_move. But invert all the object code. IE x1,y1 becomes x2,y2. Image1 becomes Frame1.

    I attached an updated version.
    Attached Files Attached Files
    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]

  7. #7

    Thread Starter
    Junior Member
    Join Date
    May 2006
    Posts
    22

    Thumbs up Thxx

    Thats Really Good Jop Keith ... I understand Now !
    Many thanks to you my friend

  8. #8
    Addicted Member
    Join Date
    Apr 2006
    Location
    USA
    Posts
    207

    Re: How Can i make this simple Group?

    You're welcome.
    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]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width