windows 映射模式总结1

 

CDC::SetViewportExt

virtual CSize SetViewportExt( int cx, int cy );

virtual CSize SetViewportExt( SIZE size );

Return Value

The previous extents of the viewport as a CSize object. When an error occurs, the x- and y-coordinates of the returned CSize object are both set to 0.

Parameters

cx

Specifies the x-extent of the viewport (in device units).

cy

Specifies the y-extent of the viewport (in device units).

size

Specifies the x- and y-extents of the viewport (in device units).

Remarks  设置x,y轴坐标的方向和坐标系包含的范围(单位为像素)

Sets the x- and y-extents of the viewport of the device context. The viewport, along with the device-context window, defines how GDI maps points in the logical coordinate system to points in the coordinate system of the actual device. In other words, they define how GDI converts logical coordinates into device coordinates.

When the following mapping modes are set, calls to SetWindowExt and SetViewportExt are ignored:

 

CDC::SetWindowExt

virtual CSize SetWindowExt( int cx, int cy );

virtual CSize SetWindowExt( SIZE size );

Return Value

The previous extents of the window (in logical units) as a CSize object. If an error occurs, the x- and y-coordinates of the returned CSize object are both set to 0.

Parameters

cx

Specifies the x-extent (in logical units) of the window.

cy

Specifies the y-extent (in logical units) of the window.

size

Specifies the x- and y-extents (in logical units) of the window.

Remarks  设置坐标系逻辑单位

Sets the x- and y-extents of the window associated with the device context. The window, along with the device-context viewport, defines how GDI maps points in the logical coordinate system to points in the device coordinate system.

When the following mapping modes are set, calls to SetWindowExt and SetViewportExt functions are ignored:

  • MM_HIENGLISH

  • MM_HIMETRIC

  • MM_LOENGLISH

  • MM_LOMETRIC

  • MM_TEXT

  • MM_TWIPS

When MM_ISOTROPIC mode is set, an application must call the SetWindowExt member function before calling SetViewportExt.

 

CDC::SetViewportOrg

virtual CPoint SetViewportOrg( int x, int y );

virtual CPoint SetViewportOrg( POINT point );

Return Value

The previous origin of the viewport (in device coordinates) as a CPoint object.

Parameters

x

Specifies the x-coordinate (in device units) of the origin of the viewport. The value must be within the range of the device coordinate system.

y

Specifies the y-coordinate (in device units) of the origin of the viewport. The value must be within the range of the device coordinate system.

point

Specifies the origin of the viewport. The values must be within the range of the device coordinate system. You can pass either a POINT structure or a CPoint object for this parameter.

Remarks

Sets the viewport origin of the device context. The viewport, along with the device-context window, defines how GDI maps points in the logical coordinate system to points in the coordinate system of the actual device. In other words, they define how GDI converts logical coordinates into device coordinates.

The viewport origin marks the point in the device coordinate system to which GDI maps the window origin, a point in the logical coordinate system specified by the SetWindowOrg member function. GDI maps all other points by following the same process required to map the window origin to the viewport origin. For example, all points in a circle around the point at the window origin will be in a circle around the point at the viewport origin. Similarly, all points in a line that passes through the window origin will be in a line that passes through the viewport origin.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值