请输入您要查询的百科知识:

 

词条 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。

CDC::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除,依此类推。

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/1/31 15:59:44