|
-
Jul 17th, 2001, 12:40 PM
#1
Thread Starter
Frenzied Member
SetPixel
Im getting an error usng setpixel (And how do I use COLORREF?)
Can anyone give me an example of either?
-
Jul 17th, 2001, 02:49 PM
#2
Frenzied Member
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.
-
Jul 17th, 2001, 02:59 PM
#3
Thread Starter
Frenzied Member
Thanks
-
Jul 17th, 2001, 03:06 PM
#4
Thread Starter
Frenzied Member
uh oh....just tested it
error C2275: 'HDC' : illegal use of this type as an expression
-
Jul 17th, 2001, 03:31 PM
#5
Frenzied Member
You didn't use
SetPixel(HDC,234,300,green);
or
HDC = ...
right.
Post some code.
-
Jul 17th, 2001, 04:36 PM
#6
Thread Starter
Frenzied Member
the error applies to this code:
Code:
SetPixel(HDC,50,50,color); // Plot the pixel
-
Jul 17th, 2001, 07:15 PM
#7
Frenzied Member
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
-
Jul 17th, 2001, 07:22 PM
#8
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|