用vc++6.0 编程画一个椭圆出来,求完整源代码
1个回答
展开全部
#include <windows.h>
#pragma comment(linker, "/subsystem:windows")
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmd, INT nShow)
{
HWND h = CreateWindowA("#32770", "椭圆", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, 300, 200,
0, 0, hInst, 0);
HWND hs = CreateWindowA("Static", "", WS_CHILD | WS_VISIBLE | SS_BITMAP,
0, 0, 200, 100, h, 0, hInst, 0);
HDC d = GetDC(hs);
HBITMAP b = CreateCompatibleBitmap(d, 200, 100);
HDC m = CreateCompatibleDC(d);
SelectObject(m, b);
BitBlt(m, 0, 0, 200, 100, d, 0, 0, WHITENESS);
Ellipse(m, 0, 0, 200, 100);
DeleteDC(m);
ReleaseDC(hs, d);
SendMessage(hs, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)b);
MSG mg;
while( GetMessageA(&mg, 0, 0, 0) > 0 ) {
if (mg.message == WM_COMMAND && mg.wParam == (WPARAM)MAKEWORD(IDCANCEL, BN_CLICKED))
break;
TranslateMessage(&mg);
DispatchMessageA(&mg);
}
DeleteObject(b);
DestroyWindow(h);
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询