SelectClipRgn

SelectClipRgn是?>函式功能:該函式選擇一個區域作為指定設備環境的當前剪下區域。

基本介紹

  • 中文名:SelectClipRgn
  • 頭檔案:wingdi.h
  • 庫檔案:gdi32.lib
  • Windows:95及以上版本
介紹,原型,

介紹

函式功能:該函式選擇一個區域作為指定設備環境的當前剪下區域。
函式原型: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+類庫中的解釋

原型

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除,依此類推。

相關詞條

熱門詞條

聯絡我們