看一本参考书,上面写到关于构造和析够CDC对象;在一个函数中构造设备环境:
CRect rect;
CDC* pDC = GetDC();
pDC->GetClipBox(rect);
...
ReleaseDC(pDC);
请问语句CRect rect;pDC->GetClipBox(rect);的作用是什么,我去掉这两句也可以
通过CPen pPen;
pPen.CreatePen(PS_SOLID,1,RGB(0,255,0));
CPen *pOldPen = pDC->SelectObject(&pPen);
pDC->MoveTo(10,0);
pDC->LineTo(10,100);
也可以绘图啊?
CRect rect;
CDC* pDC = GetDC();
pDC->GetClipBox(rect);
...
ReleaseDC(pDC);
请问语句CRect rect;pDC->GetClipBox(rect);的作用是什么,我去掉这两句也可以
通过CPen pPen;
pPen.CreatePen(PS_SOLID,1,RGB(0,255,0));
CPen *pOldPen = pDC->SelectObject(&pPen);
pDC->MoveTo(10,0);
pDC->LineTo(10,100);
也可以绘图啊?
The GetClipBox function retrieves the dimensions of the tightest bounding rectangle that can be drawn around the current visible area on the device. The visible area is defined by the current clipping region or clip path, as well as any overlapping windows. int GetClipBox(
HDC hdc, // handle to DC
LPRECT lprc // rectangle
);
Parameters
hdc
[in] Handle to the device context.
lprc
[out] Pointer to a RECT structure that is to receive the rectangle dimensions, in logical units.
Return Values
If the function succeeds, the return value specifies the clipping box's complexity and can be one of the following values. Value Meaning
NULLREGION Region is empty.
SIMPLEREGION Region is a single rectangle.
COMPLEXREGION Region is more than one rectangle.
ERROR An error occurred.
GetClipBox returns logical coordinates based on the given device context. 我觉得应该是:GetClipBox来获取刷新时需要更新的区域