SetViewportOrgEx---GDI学习

The SetViewportOrgEx function specifies which device point maps to the window origin (0,0).

总是对这个系列的函数不太清楚,ViewPort(Device Point),WindowPort(Logic Point),这个函数将参数中指定的x,y(设备坐标),映射到Window Origin(0,0),也就是你实用GDI时其坐标原点现在在(x,y)而不是UpLeft。

BOOL SetViewportOrgEx(
  HDC hdc,        // handle to device context
  int X,          // new x-coordinate of viewport origin
  int Y,          // new y-coordinate of viewport origin
  LPPOINT lpPoint // original viewport origin
);
Parameters
hdc
[in] Handle to the device context.
X
[in] Specifies the x-coordinate, in device units, of the new viewport origin.
Y
[in] Specifies the y-coordinate, in device units, of the new viewport origin.
lpPoint
[out] Pointer to a POINT structure that receives the previous viewport origin, in device coordinates. If lpPoint is NULL, this parameter is not used.

This function (along with SetViewportExtEx and SetWindowExtEx) helps define the mapping from the logical coordinate space (also known as a window) to the device coordinate space (the viewport).

这个函数与SetViewportExtEx and SetWindowExtEx一起使用使得逻辑坐标映射到相应的设备坐标SetViewportOrgEx specifies which device point maps to the logical point (0,0). It has the effect of shifting the axes so that the logical point (0,0) no longer refers to the upper-left corner.

//map the logical point (0,0) to the device point (xViewOrg, yViewOrg)
SetViewportOrgEx ( hdc, xViewOrg, yViewOrg, NULL)

This is related to the SetWindowOrgEx function. Generally, you will use one function or the other, but not both. Regardless of your use of SetWindowOrgEx and SetViewportOrgEx, the device point (0,0) is always the upper-left corner

SetWindowOrgEx可以达到同样的作用,但是通常情况下只应该使用其中的一个(记住),注意:不管是使用SetWindowOrgEx还是SetViewportOrgEx,设备点(0,0)始终是在左上角的。

 

为了以后不在这里纠缠不清,以后都只用这个函数了,现在GDI中的(0,0)现在是(x,y)了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值