1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#pragma once
void OnPaint(HWND hWnd) {
HDC hdc;
PAINTSTRUCT ps;
HFONT hfont;
LOGFONT f={0};
HGDIOBJ holdfont;
char *fonts[]={"Arial","Times New Roman","Comic Sans MS"};
int i;
hdc=BeginPaint(hWnd,&ps);
for (i=0;i<3;i++)
strcpy(f.lfFaceName,fonts[i]);
f.lfHeight=40*(i+1);
f.lfItalic=1;
hfont=CreateFontIndirect(&f);
holdfont=SelectObject(hdc,hfont);
SetTextColor(hdc,RGB(0,0,255));
TextOut(hdc,10,70*i,"HELLO WINDOW",13);
SelectObject(hdc,holdfont);
DeleteObject(hfont);
}
/*
void OnPaint(HWND hWnd) {
HDC hdc;
PAINTSTRUCT ps;
HBRUSH hbr;
HGDIOBJ holdbr;
POINT pt[5]={250,150,250,300,300,350,400,300,320,190};
hdc=BeginPaint(hWnd,&ps);
hbr=CreateSolidBrush(RGB(255,0,0));
holdbr=SelectObject(hdc,hbr);
MoveToEx(hdc,10,10,NULL);
LineTo(hdc,200,10);
Rectangle(hdc,10,20,200,100);
RoundRect(hdc,10,120,200,220,20,20);
Ellipse(hdc,10,240,200,340);
Pie(hdc,250,10,350,11,350,110,350,10);
Polygon(hdc,pt,5);
SelectObject(hdc,holdbr);
DeleteObject(hbr);
EndPaint(hWnd,&ps);
}
*/
|