drawing a moveable line in MFC

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mvjohn100
    New Member
    • Mar 2008
    • 57

    drawing a moveable line in MFC

    Hello,

    In an MFC application I want to draw a line which should move around after the drawing what can I do?

    Thanks,
    john
  • lini
    New Member
    • Mar 2007
    • 12

    #2
    Hi,
    Very wild guess is you keep invalidating the area where the line is and inside your WM_PAINT handler draw it again at another position. Alternatively you may switch your draw mode, so that when you draw the same line, it is actually erased, and then switch back to normal mode and draw it again at another position.

    Once again, just a guess, correct me if I am wrong!
    Cheers,
    Lini

    Comment

    • Studlyami
      Recognized Expert Contributor
      • Sep 2007
      • 464

      #3
      What do you want the line to do? What is the purpose of the line? You could manually redraw the line at a different location in the OnPaint function. You could also create a new window without a border and form it to the size of the line you want. This would allow you to move the "line" as you would a window. This would also give you the option to allow the user to move around the line.

      Comment

      • george666
        New Member
        • Jul 2008
        • 28

        #4
        You can see professional win32 ng (news://comp.os.ms-windows.programmer.win32)
        for a sample code doing _exactly_ that (MS)
        (and more, as it's a drawing program to draw any shapes...)

        Comment

        Working...