draw multiple lines and move then on screen

Discussion in 'C' started by sujan.dasmahapatra, Jul 28, 2013.

  1. sujan.dasmahapatra

    sujan.dasmahapatra Member

    Joined:
    Jun 11, 2009
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    Gender:
    Male
    I am writing a pure C based win32 applications. I have drawn line. Now i want to translate that line, move the line whereved user wants to move on screen. Then again I drawn another line, I am drawing multiple lines.

    I have created rectangle region for each line and trying to move the line.

    When I move the 2nd line over the 1st line on screen the 1st line is getting wiped out. Because I am InvalidateRect() of the rect for the line being moved, so when that rectangle is crossing the other line then the other line is getting removed from the screen.

    How can I rectify it. How can I have all the lined being on the screen and moved according to the user's wish. The code should be pure C and win32 no MFC. Please help me how can I do it. Any help is highly appreciated. Thanks Sujan
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    You need to keep track of all the lines you want displayed and redraw them as needed. You can either test each line for intersection with the invalidated rectangle, or you can just redraw them all anyway as Windows clips updates to the invalidated rectangle (assuming you're using BeginPaint and EndPaint).
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice