VC中的GDI+怎么用
显示除位图之外的图片用GDI+,谁能告诉我怎么用,给我个VC例子
回复:(wudong8866)VC中的GDI+怎么用
o Drawing a line with GDI采用GDI画线,您需要2个对象:设备场景和画笔。您通过调用CreatePen获取一个句柄。紧接着,您调用SelectObject将画笔选入设备场景。然后调用MoveToEx将画笔位置设为(20,10),然后调用绘制一条直线到位置(200,100)。注意MoveToEx和LineTo均需要一个hdc作为参数。
HDC hdc;
PAINTSTRUCT ps;
HPEN hPen;
HPEN hPenOld;
hdc = BeginPaint(hWnd, &ps);
hPen = CreatePen(PS_SOLID, 3, RGB(255, 0, 0));
hPenOld = (HPEN)SelectObject(hdc, hPen);
MoveToEx(hdc, 20, 10, NULL);
LineTo(hdc, 200, 100);
SelectObject(hdc, hPenOld);
DeleteObject(hPen);
EndPaint(hWnd, &ps);