用vc++6.0软件c++语言编一个程序画圆,显示一个圆出来谁懂??求给出完整源代码
3个回答
展开全部
#include <stdio.h>
#include <windows.h>
#pragma comment(lib, "user32.lib")
#pragma comment(lib, "gdi32.lib")
LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l)
{
switch(m) {
case WM_NCDESTROY:
PostQuitMessage(0);
return 0;
case WM_PAINT: {
HDC dc = GetDC(h);
Ellipse(dc, 0, 0, 200, 200);
ReleaseDC(h, dc);
ValidateRect(h, 0);
return 0;
}
default:
return DefWindowProc(h,m,w,l);
}
}
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmd, INT nShow)
{
WNDCLASS wc;
GetClassInfo(hInst, TEXT("#32770"), &wc);
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.lpszClassName = TEXT("dc");
wc.lpfnWndProc = WndProc;
wc.hbrBackground = (HBRUSH) COLOR_WINDOW;
RegisterClass(&wc);
HWND h = CreateWindow(TEXT("dc"), TEXT("圆"), WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, NULL, NULL, hInst, NULL);
ShowWindow(h, SW_SHOWNORMAL);
UpdateWindow(h);
MSG m;
while(GetMessage(&m, 0, 0, 0) > 0) {
TranslateMessage(&m);
DispatchMessage(&m);
}
return m.wParam;
}
给
更多追问追答
追问
这个是MFC么??
追答
不是。
…………你问题中又没有说明要MFC
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询