Need explanation ...
-
Does some of you could tell me what's the function of the codes below: Thanks! void DisplayShape(bool Light) { HPEN hNPen,hOPen; HBRUSH hOldBrush,hNewBrush; COLORREF cfill; if (Light) { if (cluminance == 3) return; cluminance = 3; cfill=RGB(0,255,0); } else switch(cluminance) { case 3: {cluminance--; cfill=RGB(64,255,64); break;} case 2: {cluminance--; cfill=RGB(128,255,128); break;} case 1: {cluminance--; cfill=RGB(192,255,192); break;} default: cfill=RGB(255,255,255); } hdc = GetDC(hWndG); hNPen=CreatePen(PS_SOLID,1,RGB(0,0,0)); hOPen=(HPEN)SelectObject(hdc,hNPen); hNewBrush=CreateSolidBrush(cfill); hOldBrush=(HBRUSH)SelectObject(hdc,hNewBrush); Ellipse(hdc,393,235,443,285); DeleteObject(SelectObject(hdc,hOPen)); DeleteObject(SelectObject(hdc,hOldBrush)); ReleaseDC(hWndG,hdc); }
-
Does some of you could tell me what's the function of the codes below: Thanks! void DisplayShape(bool Light) { HPEN hNPen,hOPen; HBRUSH hOldBrush,hNewBrush; COLORREF cfill; if (Light) { if (cluminance == 3) return; cluminance = 3; cfill=RGB(0,255,0); } else switch(cluminance) { case 3: {cluminance--; cfill=RGB(64,255,64); break;} case 2: {cluminance--; cfill=RGB(128,255,128); break;} case 1: {cluminance--; cfill=RGB(192,255,192); break;} default: cfill=RGB(255,255,255); } hdc = GetDC(hWndG); hNPen=CreatePen(PS_SOLID,1,RGB(0,0,0)); hOPen=(HPEN)SelectObject(hdc,hNPen); hNewBrush=CreateSolidBrush(cfill); hOldBrush=(HBRUSH)SelectObject(hdc,hNewBrush); Ellipse(hdc,393,235,443,285); DeleteObject(SelectObject(hdc,hOPen)); DeleteObject(SelectObject(hdc,hOldBrush)); ReleaseDC(hWndG,hdc); }
It's C Code. It draws an Ellipse, and every time it is called, the colour changes. It fades up to white, but not in greyscale, the green component is always 255. Christian Graus - Microsoft MVP - C++
-
It's C Code. It draws an Ellipse, and every time it is called, the colour changes. It fades up to white, but not in greyscale, the green component is always 255. Christian Graus - Microsoft MVP - C++
Thanks!