Draw shapes based on the cursor location
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Draw shapes based on the cursor location

  1. #1
    Join Date
    May 2012
    Posts
    8

    Draw shapes based on the cursor location

    Good Day everyone.

    Can anyone provide some overview, possibly some flow on the program that i currently trying to do? Possibly some example that I can refer to.


    I already have a menu to select shapes that i want to draw.
    I wanted to draw a shape anywhere in the client area based on my mouse clicked. Let say a triangle.
    The location of mouse pointer, in the centre of my triangle.
    As long as I didn't choose new shape to draw, I can keep drawing new triangle anywhere in the client area.

    I'm using polyline to draw my shape. my question is, what should I include inside my programming in order for my program able to perform the above task?


    Regard,
    Kurogane.

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,070

    Re: Draw shapes based on the cursor location

    my question is, what should I include inside my programming in order for my program able to perform the above task?
    I wonder what would "include" really mean there? Typically people ask what they should do, or how to act about drawing, but not what they should "include inside their programming." Please rephrase to let us understand your question.
    Best regards,
    Igor

  3. #3
    Join Date
    May 2012
    Posts
    8

    Re: Draw shapes based on the cursor location

    sorry.. my bad. yeah. actually i was asking how should i program it? especially on the drawing part.
    I am very grateful if some example can be included. thank you.


    best regards,
    Kurogane.

  4. #4
    Join Date
    May 2012
    Posts
    8

    Re: Draw shapes based on the cursor location

    one of the thing i dont know is:

    Code:
    case WM_CREATE:
             hwndStatic = CreateWindow(TEXT("static"), TEXT(""), 
                      WS_CHILD | WS_VISIBLE,
                      150, 80, 90, 25, hWnd, NULL, g_hinst, NULL);
              break;
    
    case WM_LBUTTONDOWN:
    				x = LOWORD (lParam);
    				y = HIWORD (lParam);
    				GetCursorPos(&coord);
    			 break;
    the above is my current code. the next step i want to do is the show the value of coordinate x and coordinate y inside my hwndstatic. how can i do that?

  5. #5
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

    Re: Draw shapes based on the cursor location


  6. #6
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,070

    Re: Draw shapes based on the cursor location

    MFC sample
    Attached Files Attached Files
    Best regards,
    Igor

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center