CreateRectRgn

createrectrgn 创建一个矩形区域 

VB声明 Declare Function CreateRectRgn Lib "gdi32" Alias "CreateRectRgn" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long 说明 创建一个由点X1,Y1和X2,Y2描述的矩形区域 返回值 Long,执行成功为区域句柄,失败则为零 参数表 参数 类型及说明 X1,Y1 Long,矩形左上角X,Y坐标 X2,Y2 Long,矩形右下角X,Y坐标 注解

不用时一定要用DeleteObject函数删除该区域
这个矩形的下边和右边不包含在区域之内



CreateRectRgn()用来创建一个“剪裁区域”;至于剪裁区域,它是对显示器上一个范围的描述,这个范围是矩形、多边形和椭圆的组合。剪裁区域一般用来绘制和剪裁,通过将剪裁区域选进设备上下文,就可以用剪裁区域来进行剪裁(就是说,将可以绘图的范围限制为显示区域的一部分)。它是GDI对象。在GDI中当函数名称中包含Rgn字符时,一般表示此函数与剪裁区域有关。 



CRgn::CreateRectRgn

BOOL CreateRectRgn( int x1, int y1, int x2, int y2 );

返回值:如果操作成功则返回非零值;否则返回0。

参数: x1 指定区域的左上角的逻辑x坐标。 
y1 指定区域左上角的逻辑y坐标。 
x2 指定区域右下角的逻辑x坐标。 
y2 指定区域的右下角的逻辑y坐标。 

说明:
此成员函数用来创建一个矩形区域,该区域被保存在CRgn对象中。
区域的大小被限制在32767×32767个逻辑单位和64K内存这两个值中较小的那个值的范围内。
当使用完了由CreateRectRgn函数创建的区域时,应用程序应该将此区域选择出设备环境外,并用CGDIObject::DeleteObject函数来删除它。



Creates a rectangular region that is stored in the CRgn object.

BOOL CreateRectRgn(
   int x1,
   int y1,
   int x2,
   int y2 
);
x1

Specifies the logical x-coordinate of the upper-left corner of the region.

y1

Specifies the logical y-coordinate of the upper-left corner of the region.

x2

Specifies the logical x-coordinate of the lower-right corner of the region.

y2

Specifies the logical y-coordinate of the lower-right corner of the region.

Nonzero if the operation succeeded; otherwise 0.

The size of a region is limited to 32,767 by 32,767 logical units or 64K of memory, whichever is smaller.

When it has finished using a region created by CreateRectRgn, an application should use the CGDIObject::DeleteObject member function to remove the region.

Visual C++
CRgn   rgn;

BOOL bSucceeded = rgn.CreateRectRgn( 50, 20, 150, 120 );
ASSERT( bSucceeded == TRUE );

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值