Results 1 to 6 of 6

Thread: Simple Graphics Question

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2001
    Posts
    57

    Simple Graphics Question

    What is the closest translation of

    Me.PSet (posx, posy), vbBlack

    into C++ using API?

    The shape does not have to be circular, but I must be able to change the color (vbGreen, vbRed).

    PS I am using VC++ 6.0

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Code:
    SetPixel
    The SetPixel function sets the pixel at the specified coordinates to the specified color. 
    
    COLORREF SetPixel(
      HDC hdc,           // handle to device context
      int X,             // x-coordinate of pixel
      int Y,             // y-coordinate of pixel
      COLORREF crColor   // pixel color
    );
    Code:
    SetPixel(hdc,posx,posy,RGB(0,0,0));
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2001
    Posts
    57

    Size???

    Is there a way to specify the size of the dot?

    Just like: Me.DrawWidth = 6

    Thanks


    chilibean

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Yes. Draw an ellipse, rectangle, whatever.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    SetPixel does exactly what it says, it sets one pixel. Like Parksie suggests, if you want to draw a bigger dot then either use SetPixel on several adjacent pixels, or use a different GDI function like Rectangle() or Ellipse() (these draw squares and circles too, with the right parameters). You will have to set the pen and brush for the DC to whatever colours you want to draw the dot in (the pen is the outline, the brush is the fill, in case you didn't know).
    Harry.

    "From one thing, know ten thousand things."

  6. #6

    Thread Starter
    Member
    Join Date
    Feb 2001
    Posts
    57

    Thank you

    Thank you all for helping me out. I got all the answers I need.

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