15,979
社区成员
发帖
与我相关
我的任务
分享
CString sText = "TEXT";
CRect rect;
GetClientRect(&rect);
Bitmap * bmSave = new Bitmap(rect.right - rect.left,rect.bottom - rect.top);
Graphics * gSave = Graphics::FromImage(bmSave);
gSave->Clear(Color.White);
Pen pen(RGB(0,100,100), 1);
Point point1(100,100);
Point point2(300,300);
gSave->DrawLine(&pen,point1,point2);
gSave->DrawLine(&pen,300,300,800,600);
CPen pPen(PS_SOLID,1,RGB(255,0,0));
POINT pPoint1;
POINT pPoint2;
pPoint1.x = 10;
pPoint1.y = 10;
pPoint2.x = 500;
pPoint2.y = 500;
CClientDC ClientDc(this);
CDC * cDC = new CDC;
cDC->CreateCompatibleDC(&ClientDc);
cDC->SelectObject(bmSave);
cDC->SelectObject(pPen);
cDC->MoveTo(pPoint1);
cDC->LineTo(pPoint2);
CLSID clsid;
GetImageCLSID(L"image/jpeg",&clsid);
bmSave->Save(sfilename.AllocSysString(),&clsid,NULL);