Results 1 to 8 of 8

Thread: SetPixel

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    SetPixel

    Im getting an error usng setpixel (And how do I use COLORREF?)

    Can anyone give me an example of either?

  2. #2
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544
    Use this:

    Code:
    COLORREF green = RGB(0,255,0); // Create the color green
    SetPixel(hdc,234,300,green); // Plot the pixel
    Use COLORREF to create the color you want to draw with.
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Thanks

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    uh oh....just tested it

    error C2275: 'HDC' : illegal use of this type as an expression

  5. #5
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    You didn't use
    SetPixel(HDC,234,300,green);
    or
    HDC = ...

    right.
    Post some code.
    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

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    the error applies to this code:

    Code:
    SetPixel(HDC,50,50,color); // Plot the pixel

  7. #7
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Well the error is very obvious. HDC is a datatype like (not exactly the same but it is a datatype) int,double.
    You can't use a datatype as an expression.
    int a = int //same error
    You have to declare a variable of that type first.
    int b = 5;
    int a = b;


    In your case
    Code:
    HDC myDC = GetDC(somehwnd);
    SetPixel(myDC,50,50,color); // Plot the pixel
    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

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    you're the man

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