繪制背景,我想獨立出一塊區域不繪制,如何做?
uj5u.com熱心網友回復:
Graphics::SetClip(hRgn, combineMode)
The SetClip method updates the clipping region of this Graphics object to a region that is the combination of itself and a GDI region.
Status SetClip(
HRGN hRgn,
CombineMode combineMode
);
Parameters
hRgn
[in] Handle to a GDI region to be combined with the clipping region of this Graphics object. This is provided for legacy code. New applications should pass a Region object as the first parameter.
combineMode
[in] Optional. Element of the CombineMode enumeration that specifies how the GDI region is combined with the clipping region of this Graphics object. The default value is CombineModeReplace.
Return Values
If the method succeeds, it returns Ok, which is an element of the Status enumeration.
If the method fails, it returns one of the other elements of the Status enumeration.
Remarks
This method assumes that the GDI region specified by hRgn is already in device units, so it does not transform the coordinates of the GDI region.
Example Code [C++]
The following example uses a GDI region to update the clipping region.
VOID Example_SetClip2(HDC hdc)
{
Graphics graphics(hdc);
// Create a Region object, and get its handle.
Region region(Rect(0, 0, 100, 100));
HRGN hRegion = region.GetHRGN(&graphics);
// Set the clipping region with hRegion.
graphics.SetClip(hRegion);
// Fill a rectangle to demonstrate the clipping region.
graphics.FillRectangle(&SolidBrush(Color(255, 0, 0, 0)), 0, 0, 500, 500);
}
combineMode取值見MSDN
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/116872.html
標籤:界面
上一篇:關于MFC定時器?
