Click to See Complete Forum and Search --> : SetPixel
SteveCRM
Jul 17th, 2001, 12:40 PM
Im getting an error usng setpixel (And how do I use COLORREF?)
Can anyone give me an example of either? :)
CyberCarsten
Jul 17th, 2001, 02:49 PM
Use this:
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.
SteveCRM
Jul 17th, 2001, 02:59 PM
Thanks :D
SteveCRM
Jul 17th, 2001, 03:06 PM
uh oh....just tested it
error C2275: 'HDC' : illegal use of this type as an expression
Vlatko
Jul 17th, 2001, 03:31 PM
You didn't use
SetPixel(HDC,234,300,green);
or
HDC = ...
right.
Post some code.
SteveCRM
Jul 17th, 2001, 04:36 PM
the error applies to this code:
SetPixel(HDC,50,50,color); // Plot the pixel
Vlatko
Jul 17th, 2001, 07:15 PM
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
HDC myDC = GetDC(somehwnd);
SetPixel(myDC,50,50,color); // Plot the pixel
SteveCRM
Jul 17th, 2001, 07:22 PM
you're the man :D
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.