我画的圆,总感觉不圆,有锯齿
有什么好办法解决吗?
有什么好办法解决吗?
解决方案 »
- 在桌面下所有线程禁用键盘上某个按键比如win键
- 请教高手们:extern "C" void WinMainCRTStartup()函数中不能使用assert函数
- 如何获取音频文件的ID3信息
- 我写了一个全局钩子(在DLL中),用EXE调用DLL时很正常,但写了一个服务调用DLL,钩子过程函数就不起作用了?
- 谁有COM技术内幕一书
- 请问如何将一个Lpctstr的值追加到另外一个Lpctstr的后面?
- 怎样生成-0.2到0.2之间的随机数
- VC++超难问题,如何复制webbrowser控件显示页面?
- 初学者提问:C++多重继承的优点和缺点是什么?
- 谁见过new分配完内存.又把以分配的空间又在分配给别的对象
- 关于定义对象的问题!
- 关于时间问题
{
CPaintDC dc(this);
Graphics gdi(dc.m_hDC);
gdi.SetSmoothingMode(SmoothingModeHighSpeed);
gdi.FillEllipse(&SolidBrush(Color(255, 0, 0, 0)), 0, 0, 200, 100);
}
可界面为什么没有东西呢?
这样只是填充一块区域,而不是画个轮廓。
#include <windows.h>
#include <gdiplus.h>
using namespace Gdiplus;VOID OnPaint(HDC hdc)
{
Graphics graphics(hdc);
Pen pen(Color(255, 0, 0, 255));
graphics.DrawLine(&pen, 0, 0, 200, 100);
}LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, PSTR, INT iCmdShow)
{
HWND hWnd;
MSG msg;
WNDCLASS wndClass;
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
// Initialize GDI+.
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
wndClass.style = CS_HREDRAW | CS_VREDRAW;
wndClass.lpfnWndProc = WndProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = hInstance;
wndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = TEXT("GettingStarted");
RegisterClass(&wndClass);
hWnd = CreateWindow(
TEXT("GettingStarted"), // window class name
TEXT("Getting Started"), // window caption
WS_OVERLAPPEDWINDOW, // window style
CW_USEDEFAULT, // initial x position
CW_USEDEFAULT, // initial y position
CW_USEDEFAULT, // initial x size
CW_USEDEFAULT, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInstance, // program instance handle
NULL); // creation parameters
ShowWindow(hWnd, iCmdShow);
UpdateWindow(hWnd);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
GdiplusShutdown(gdiplusToken);
return msg.wParam;
} // WinMainLRESULT CALLBACK WndProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
switch(message)
{
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
OnPaint(hdc);
EndPaint(hWnd, &ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
} // WndProc