5. 5
HBRUSH
CreateBrushIndirect: Creates a brush with a specified style,
color, and pattern
CreateDIBPatternBrushPt: Creates a brush with the pattern
from a DIB
CreateHatchBrush: Creates a brush with a hatch pattern and
color
CreatePatternBrush: Creates a brush with a bitmap pattern
CreateSolidBrush: Creates a brush with a solid color
V鱈 d畛:
hBr = CreateSolidBrush(255);
hOldBr = SelectObject(hdc,hBr);
Rectangle(hdc,0,0,400,200);
13. 13
Robot
case WM_TIMER:
x += robot[n].dx;
y += robot[n].dy;
n = robot[n].next ;
InvalidateRect(hWnd, NULL,TRUE);
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
DrawRobot(hdc);
EndPaint(hWnd, &ps);
break;
14. 14
Bi t畉p 4
M担 t畉:
Vi畉t m畛t ch動董ng tr狸nh cho ph辿p i畛u khi畛n
robot di chuy畛n tr棚n mn h狸nh. Robot lu担n di
chuy畛n, ng動畛i s畉 i畛u khi畛n h動畛ng i c畛a robot
15. 15
Bi t畉p 5
畛ng h畛 KIM
M担 t畉
Vi畉t ch動董ng tr狸nh m担 ph畛ng 畛ng h畛 kim tr棚n
m叩y t鱈nh.
16. 16
Bi t畉p 5
H動畛ng d畉n:
S畛 d畛ng hm sau 畛 l畉y ngy gi畛 h畛 th担ng:
void GetLocalTime( LPSYSTEMTIME lpSystemTime );
typedef struct _SYSTEMTIME {
WORD wYear; WORD wMonth;
WORD wDayOfWeek; WORD wDay;
WORD wHour; WORD wMinute; WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME