Code:
case WM_PAINT:
RECT rt;
HFONT hfont;
int y,iOffset;
POINT pt[4];
SIZE size;
int a,b,c;
TEXTMETRIC tm ;
RECT user1, user2, user3, user4, user5;
struct labels{
RECT name;
RECT height;
RECT weight;
RECT drug1;
RECT drug2;
RECT drug3;
RECT symptoms;
};
labels MyLabels;
InvalidateRect (hWnd, NULL, TRUE) ;
hdc = BeginPaint(hWnd, &ps);
GetClientRect (hWnd, &rect) ;
rect.left += GetDeviceCaps (hdc, LOGPIXELSX) / 2 ;
rect.top += GetDeviceCaps (hdc, LOGPIXELSY) / 2 ;
rect.right =- GetDeviceCaps (hdc, LOGPIXELSX) / 4 ;
SelectObject (hdc, CreateFontIndirect (&lf)) ;
SetTextColor (hdc, cf.rgbColors) ;
DeleteObject (SelectObject (hdc, GetStockObject (SYSTEM_FONT))) ;
if(PartyLoaded == 0){
//TODO: Add drawing code for first explanation screen
hfont = EzCreateFont (hdc, TEXT("Brush Script MT"), 1500, 0, EZ_ATTR_BOLD, TRUE);
SelectObject (hdc, GetStockObject(WHITE_BRUSH));
GetClientRect(hWnd, &rt);
Rectangle (hdc, rt.left, rt.top, rt.right, rt.bottom) ;
SelectObject (hdc, hfont);
GetTextExtentPoint32 (hdc, szAppName, lstrlen (szAppName), &size) ;
GetClientRect(hWnd, &rt);
hdcWidth=GetDeviceCaps (hdc, HORZRES) ;
hdcHeight=GetDeviceCaps (hdc, VERTRES) ;
BeginPath (hdc);
TextOut (hdc, (cxArea -size.cx) /2, (cyArea - size.cy) /7 , szAppName, lstrlen (szAppName));
EndPath (hdc);
SelectClipPath (hdc, RGN_COPY);
iOffset = (cxArea + cyArea) / 4;
for (y=-iOffset; y < cyArea + iOffset; y++){
pt[0].x=0;
pt[0].y=y;
pt[1].x=cxArea /3;
pt[1].y=y+iOffset;
pt[2].x=2*cxArea/3;
pt[2].y=y-iOffset;
pt[3].x=cxArea;
pt[3].y=y;
a=rand()%256;
b=rand()%256;
c=rand()%256;
SelectObject (hdc, CreatePen (PS_SOLID, 1, RGB (a, b, c)));
PolyBezier(hdc, pt, 4);
DeleteObject ( SelectObject (hdc, GetStockObject(BLACK_PEN)));
}
SelectObject(hdc, GetStockObject(SYSTEM_FONT));
SelectObject(hdc, EzCreateFont (hdc, TEXT("Times New Roman"), 150, 0, EZ_ATTR_BOLD, TRUE));
rect.top=rect.bottom+20;
rect.bottom=rect.top+150;
DeleteObject (hfont);
}
else if(PartyLoaded==1){
//TODO: Add drawing code for drawing of the party information
GetClientRect (hWnd, &rect) ;
GetTextMetrics (hdc, &tm) ;
a=0;
y=0;
if(iPartyMemb==0){
MessageBox(hWnd, TEXT("Party is loaded but with no members"), TEXT("Party is loaded with no members"),MB_OK);
}
SelectObject(hdc, GetStockObject(SYSTEM_FONT));
SelectObject(hdc, GetStockObject(WHITE_BRUSH));
SelectObject(hdc, GetStockObject(BLACK_PEN));
a=cxArea/7;
b=tm.tmHeight;
SetRect( &MyLabels.name, rect.left, rect.top, a, rect.top + b);
SetRect( &MyLabels.height, rect.left + a, rect.top, rect.right + (2 * a), b);
SetRect( &MyLabels.weight, rect.left + (2 * a), rect.top, rect.right + (3 * a), b);
SetRect( &MyLabels.drug1, rect.left + (3 * a), rect.top, rect.right + (4 * a), b);
SetRect( &MyLabels.drug2, rect.left + (4 * a), rect.top, rect.right + (5 * a), b);
SetRect( &MyLabels.drug3, rect.left + (5 * a), rect.top, rect.right + (6 * a), b);
SetRect( &MyLabels.symptoms, rect.left + (6 * a), rect.top, rect.right + (7 * a), b);
FrameRect(hdc, &MyLabels.name,(HBRUSH)GetStockObject(BLACK_BRUSH));
FrameRect(hdc, &MyLabels.height,(HBRUSH)GetStockObject(BLACK_BRUSH));
FrameRect(hdc, &MyLabels.weight,(HBRUSH)GetStockObject(BLACK_BRUSH));
FrameRect(hdc, &MyLabels.drug1,(HBRUSH)GetStockObject(BLACK_BRUSH));
FrameRect(hdc, &MyLabels.drug2,(HBRUSH)GetStockObject(BLACK_BRUSH));
FrameRect(hdc, &MyLabels.drug3,(HBRUSH)GetStockObject(BLACK_BRUSH));
FrameRect(hdc, &MyLabels.symptoms,(HBRUSH)GetStockObject(BLACK_BRUSH));
while(y<iPartyMemb){
if(y==0){
a=0;
}
else{
a=cyArea/y;
}
Rectangle(hdc,rect.left,rect.top+a,rect.right,rect.bottom+a);
y++;
}
}
else{
//TODO: Add code to deal with error
MessageBox(hWnd, TEXT("PartyLoaded is a number other then One or Zero"), TEXT("PartyLoaded is a number other then One or Zero"), IDOK);
}
EndPaint(hWnd, &ps);
break;
All of the Variables are getting the correct values as far as I can tell through the debugger.