#include
#include
# define PI 3.1415926
BOOLEAN InitWindowClass (HINSTANCE HINSTANCE, int nCmdShow);
LRESULT a CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
FontName HFONT CreateMyFont (TCHAR * and an int height, int lean);//create a custom font
//three parameters are respectively the font name, font size, font slope, slope/10 as a logical unit
Int WINAPI WinMain (HINSTANCE HINSTANCE, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG MSG.
if(! InitWindowClass (hInstance, nCmdShow))
{
MessageBox (NULL, _T (" failed to create a window!" ), _T (" create window "), NULL);
return 1;
}
While (GetMessage (& amp; MSG, NULL, 0, 0))
{
TranslateMessage (& amp; MSG);
DispatchMessage (& amp; MSG);
}
Return (int) MSG. WParam;
}
LRESULT a CALLBACK WndProc (HWND HWND, UINT message, WPARAM WPARAM, LPARAM LPARAM)
{
HDC HDC.
PAINTSTRUCT ps;
HFONT font;
HPEN HPEN;
LPWSTR title=L "high tang. Du fu", poem [8]={L "high winds days ape to scream, cry," L "in zhu qing Elizabeth Barbara ohm bird fly back", L "boundless fell under the wood rustling," L "not the Yangtze river flowing," L "wanli come into my autumn often visit," L "more than one hundred disease alone on the stage," L "hard bitter hate numerous frost temples," L "stop down new unstrained wine or liquor cup"};
Int r, r0, I, j=1, fontSize, fontSize0, color;
The RECT clientDimension;
POINT the begin, end, org.
Double sita.
The switch (the message)
{
Case WM_SIZE:
The InvalidateRect (hWnd, NULL, true);
break;
In case the WM_PAINT:
HDC=BeginPaint (hWnd, & amp; Ps);
HPen=CreatePen (PS_DASH, 1, RGB (127127127));
SelectObject (hDC, hPen);
GetClientRect (hWnd, & amp; ClientDimension);
If ((clientDimension. Right - clientDimension. Left) & lt; 400 | | (clientDimension. Bottom - clientDimension. Top) & lt; 300)
{
MessageBox (hWnd, _T (" screen size is too small, can't drawing!" ), _T (" error "), 0);
break;
}
R=(clientDimension. Bottom - clientDimension. Top) * 8/10;
Org. X=(clientDimension. Right - clientDimension. Left)/2;
Org. Y=(clientDimension. Bottom - clientDimension. Top) * 9/10;
Arc (hDC, org. X -r, org. Y - r, org. X + r, org. Y + r, org. X + (int) (r * sin (PI/31)), org. Y + (int) (r * cos (PI/3)), org. X - (int) (r * sin (2 * PI/3), org. Y + (int) (r * cos (2 * PI/3)));//songs for arc
For (sita=PI/6; Sita
The begin. X=org. X - (int) (r * sin (sita));
The begin. Y=org. Y - (int) (r * cos (sita));
MoveToEx (hDC, begin. X, the begin. Y, NULL);
End. X=org. X;
End. Y=org. Y;
LineTo (hDC, end. X, end. Y);
}//painting line
R0=r * 2/5;
Arc (hDC, org. X-ray r0, org. Y - r0, org. X + r0, org. Y + r0, org. X + (int) (r0 * sin (PI/31)), org. Y + (int) (r0 * cos (PI/3)), org. X - (int) (r0 * sin (2 * PI/3), org. Y + (int) (r0 * cos (2 * PI/3)));
Sita=PI/6 + PI * 4/15/5;
FontSize0=fontSize=(r - r0)/7;
R0=r - 20;
for(i=0; I<7. I++)
{
LPCWSTR outInfo=(LPCWSTR) & amp; The title [I];
FontSize=3;
Font=CreateMyFont (_T (" regular script _GB2312 "), fontSize - 5 - (int) (15) (sita + PI/* 1800/PI));
SelectObject (hDC, the font);
The begin. X=org. X + (int) (r * sin (sita));
The begin. Y=org. Y - (int) (r * cos (sita));
TextOut (hDC, begin. X, the begin. Y, outInfo, 1);
R0 - fontSize=;
DeleteObject (font);
}
For (sita=PI/6 + PI * 4/27 - PI/40; Sita
FontSize=fontSize0;
R0=r - 20;
J++;
Color=0;
for(i=0; I<7. I++)
{
Color +=255/7;
SetTextColor (hDC, RGB (255 - color, 0, color));
LPCWSTR outInfo=& amp; Poem [j] [I];
FontSize=3;
The font=CreateMyFont (_T (" Chinese travel model "), fontSize, (int) (((sita - PI/2) * 1800/PI)) % 3600);
SelectObject (hDC, the font);
The begin. X=org. X + (int) (r0 * sin (sita));
The begin. Y=org. Y - (int) (r0 * cos (sita));
TextOut (hDC, begin. X, the begin. Y, outInfo, 1);
R0 - fontSize=;
DeleteObject (font);
Sleep (10);
}
}
EndPaint (hWnd, & amp; Ps);
break;
Case WM_DESTROY:
The PostQuitMessage (0);
break;
Default:
Return DefWindowProc (hWnd, message, wParam, lParam);
break;
}
return 0;
}
FontName HFONT CreatMyFont (TCHAR * and an int height, int lean)
{
Return CreateFont (height,
0,
Lean,
0,
FW_HEAVY,
0,
0,
0,
GB2312_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH,
FontName
);
}
BOOLEAN InitWindowClass (HINSTANCE HINSTANCE, int nCmdShow)
{
Modifed WNDCLASSEX wcex;
The HWND HWND;
TCHAR szWindowClass []=_T (" window sample ");
TCHAR szTitle []=_T (" font and place the sample ");
Wcex. CbSize=sizeof (modifed WNDCLASSEX);
Wcex. Style=0;
Wcex. LpfnWndProc=WndProc;
Wcex. CbClsExtra=0;
Wcex. CbWndExtra=0;
Wcex. HInstance=hInstance;
Wcex. HIcon=LoadCursor (hInstance, MAKEINTRESOURCE (IDI_APPLICATION));
Wcex. HCursor=LoadCursor (NULL, IDC_ARROW);
Wcex. HbrBackground=(HBRUSH) GetStockObject (WHITE_BRUSH);
Wcex. LpszClassName=szWindowClass;
Wcex. LpszMenuName=NULL;
Wcex. HIconSm=LoadIcon (wcex hInstance, MAKEINTRESOURCE (IDI_APPLICATION));
if(! RegisterClassEx (& amp; Wcex))
Return FALSE;
HWnd=CreateWindow (
SzWindowClass,
SzTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT CW_USEDEFAULT,
CW_USEDEFAULT CW_USEDEFAULT,
NULL,
NULL,
HInstance,
NULL);
if(! HWnd)
Return FALSE;
ShowWindow (hWnd, nCmdShow);
UpdateWindow (hWnd);
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull