複製鏈接
請複製以下鏈接發送給好友

SelectClipRgn

鎖定
SelectClipRgn是函數功能:該函數選擇一個區域作為指定設備環境的當前剪切區域。
中文名
SelectClipRgn
頭文件
wingdi.h
庫文件
gdi32.lib
Windows
95及以上版本

目錄

SelectClipRgn基本信息

函數功能:該函數選擇一個區域作為指定設備環境的當前剪切區域。
函數原型:int SelectClipRgn(HDc hdc, HRGN hrgn);
參數:
hdc:設備環境句柄。
hrgn:標識被選擇的區域。
返回值:返回值表明了區域的複雜度,可以是下列值之一。
NULLREGION:區域為空;
SIMPLEREGION:區域為單個矩形;
COMPLEXREGION:區域為多個矩形;
ERROR:發生錯誤(以前的剪切區域不受影響)。
Windows NT:若想獲得更多錯誤信息,請調用GetLastError函數。
註釋:只有選擇區域的一個拷貝被使用,區域本身可被任何其他的設備環境所選擇,並且它還被刪除。
SelectclipRgn函數假設指定區域的座標在設備聯合中已經定義。
要想刪除一個設備環境的剪切區域,指定一個空(NULL)區域句柄。
速查:Windows NT:3.1及以上版本;Windows:95及以上版本;Windows CE:1.0及以上版本;頭文件:wingdi.h;庫文件:gdi32.lib。
FeieSoft GDI+類庫中的解釋

SelectClipRgn原型

virtualint SelectClipRgn(CRgn*pRgn);
int SelectClipRgn(CRgn*pRgn,intnMode);
返回值
The region’s type. It can be any of the following values:
區域類型,可為下列值之一:
COMPLEXREGION New clipping region has overlapping borders.
COMPLEXREGION 剪切區有覆蓋的邊界。
ERROR Device context or region is not valid.
ERROR 設備上下文無效。
NULLREGION New clipping region is empty.
NULLREGION 新剪切區為空。
SIMPLEREGION New clipping region has no overlapping borders.
SIMPLEREGION 剪切區無覆蓋邊界。
參數説明
pRgn
Identifies the region to be selected.
表明被選擇的區域。
For the first version of this function, if this value is NULL, the entire client area is selected and output is still clipped to the window.
在函數的第一種版本中,如果該值為NULL,整個客户區被選中,輸出仍剪切到窗口。
For the second version of this function, this handle can be NULLonly when the RGN_COPYmode is specified.
在函數的第二種版本中,只有指定了RGN_COPY時,該句柄才能為NULL。
nMode
Specifies the operation to be performed. It must be one of the following values:
指定要進行的操作,可為下列值之一:
RGN_AND The new clipping region combines the overlapping areas of the current clipping region and the region identified by pRgn.
RGN_AND 新剪切區包含與當前剪切區的覆蓋部分,區域由pRgn標識。
RGN_COPY The new clipping region is a copy of the region identified by pRgn. This is functionality is identical to the first version of SelectClipRgn. If the region identified by pRgnis NULL, the new clipping region becomes the default clipping region (a null region).
RGN_COPY 新剪切區是pRgn標識區域的拷貝,這與SelectClipRgn的第一種版本相同。如果pRgn標識的區域為NULL,則新剪切區成為缺省的剪切區(空區域)。
RGN_DIFF The new clipping region combines the areas of the current clipping region with those areas excluded from the region identified by pRgn.
RGN_DIFF 新剪切區包括當前剪切區和被pRgn標識區域所排除的區域。
RGN_OR The new clipping region combines the current clipping region and the region identified by pRgn.
RGN_OR 新剪切區包括當前剪切區和pRgn標識區域。
RGN_XOR The new clipping region combines the current clipping region and the region identified by pRgnbut excludes any overlapping areas.
RGN_XOR 新剪切區包括當前剪切區和pRgn標識區域,但不包括覆蓋區域。
備註
Selects the given region as the current clipping region for the device context. Only a copy of the selected region is used. The region itself can be selected for any number of other device contexts, or it can be deleted.
設備上下文選擇區域作為當前剪切區。只利用了選定區域的拷貝,函數本身可被其它設備上下文選用,或者被刪除。
The function assumes that the coordinates for the given region are specified in device units. Some printer devices support text output at a higher resolution than graphics output in order to retain the precision needed to express text metrics. These devices report device units at the higher resolution, that is, in text units. These devices then scale coordinates for graphics so that several reported device units map to only 1 graphic unit. You should always call the SelectClipRgnfunction using text units.
函數假設給定區域的座標都使用設備座標。某些打印機為保持文本的精確度,支持用比圖形輸出更高的分辨率進行文本輸出。這些設備在更高的分辨率下報告設備單位,即使用文本單位。然後為圖形縮放座標以便使幾個設備單位與1圖形單位對應。可以調用使用文本單位的SelectClipRgn函數。
Applications that must take the scaling of graphics objects in the GDI can use the GETSCALINGFACTORprinter escape to determine the scaling factor. This scaling factor affects clipping. If a region is used to clip graphics, GDI divides the coordinates by the scaling factor. If the region is used to clip text, GDI makes no scaling adjustment. A scaling factor of 1 causes the coordinates to be divided by 2; a scaling factor of 2 causes the coordinates to be divided by 4; and so on.
在GDI中必須使用圖形縮放的應用,可以使用GETSCALINGFACTOR打印程序脱離來決定縮放因子。縮放因子影響剪切。如果某區域用於剪切圖形,GDI用縮放因子來分解座標。如果用於剪切文字,GDI不作縮放調整,縮放因子為1,座標將被2除;縮放因子為2,座標將被4除,依此類推。