#include <GDIplus.h>
using namespace Gdiplus;
#pragma comment(lib,"GdiPlus.lib")
class CGDIplus2App : public CWinApp
{
public:
ULONG_PTR m_gdiplusToken;
{
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);
}
int nResponse = dlg.DoModal();
{
Gdiplus::GdiplusShutdown(m_gdiplusToken);
}
void CGDIplus2Dlg::OnDrawLine()
{
HDC hdc;
//PAINTSTRUCT ps;
Pen* myPen;
Graphics* myGraphics;
HWND hWnd=this->m_hWnd;
//hdc = ::BeginPaint(hWnd, &ps);
hdc = ::GetDC(hWnd);
myPen = new Pen(Color(255, 255, 0, 0), 3);
myGraphics = new Graphics(hdc);
myGraphics->DrawLine(myPen, 20, 10, 400, 200);
delete myGraphics;
delete myPen;
//::EndPaint(hWnd, &ps);
::ReleaseDC(hWnd,hdc);
}
using namespace Gdiplus;
最新推荐文章于 2021-03-05 10:27:56 发布