draw multiple lines and move then on screen
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: draw multiple lines and move then on screen

  1. #1
    Join Date
    Sep 2007
    Location
    Bangalore,India
    Posts
    163

    Smile draw multiple lines and move then on screen

    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. #2
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,023

    Re: draw multiple lines and move then on screen

    It would be helpful if you posted your code so that we can see what you are doing. What are you doing for the WM_PAINT message?
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,016

    Re: draw multiple lines and move then on screen

    You may want to post your code for drawing...
    Victor Nijegorodov

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,883

    Re: draw multiple lines and move then on screen

    Quote Originally Posted by sujan.dasmahapatra View Post
    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.
    The main principle is: you remember all the objects you have drawn (color, weight, location, orientation, etc.), and you re-draw every single object on WM_PAINT.

    See the sample project in the post.
    Best regards,
    Igor

  5. #5

    Re: draw multiple lines and move then on screen

    For drawing with 2D application, to use MFC will saves much time, and some sample like drawcli will be help, and a few other third - party library (like E-XD++ Visualization) will saves you more time.

    Jackie Zhang

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center