SetScrollSizes( nMapMode, GetDocument( )->GetMyDocSize( ) )中的MSDN解释

 

void SetScrollSizes( int nMapMode, SIZE sizeTotal, const SIZE& sizePage = sizeDefault, const SIZE& sizeLine = sizeDefault );

Parameters

nMapMode

The mapping mode to set for this view. Possible values include:

Mapping ModeLogical UnitPositive y-axis Extends...
MM_TEXT1 pixelDownward
MM_HIMETRIC0.01 mmUpward
MM_TWIPS1/1440 inUpward
MM_HIENGLISH0.001 inUpward
MM_LOMETRIC0.1 mmUpward
MM_LOENGLISH0.01 inUpward

All of these modes are defined by Windows. Two standard mapping modes, MM_ISOTROPIC and MM_ANISOTROPIC, are not used for CScrollView. The class library provides the SetScaleToFitSize member function for scaling the view to window size. Column three in the table above describes the coordinate orientation.

sizeTotal

The total size of the scroll view. The cx member contains the horizontal extent. The cy member contains the vertical extent. Sizes are in logical units. Both cx and cy must be greater than or equal to 0.

sizePage

The horizontal and vertical amounts to scroll in each direction in response to a mouse click in a scroll-bar shaft. The cx member contains the horizontal amount. The cy member contains the vertical amount.

sizeLine

The horizontal and vertical amounts to scroll in each direction in response to a mouse click in a scroll arrow. The cx member contains the horizontal amount. The cy member contains the vertical amount.

Remarks

Call SetScrollSizes when the view is about to be updated. Call it in your override of the OnUpdate member function to adjust scrolling characteristics when, for example, the document is initially displayed or when it changes size.

You will typically obtain size information from the view’s associated document by calling a document member function, perhaps called GetMyDocSize, that you supply with your derived document class. The following code shows this approach:

SetScrollSizes( nMapMode, GetDocument( )->GetMyDocSize( ) );

Alternatively, you might sometimes need to set a fixed size, as in the following code:

SetScrollSizes( nMapMode, CSize(100, 100) );

You must set the mapping mode to any of the Windows mapping modes except MM_ISOTROPIC or MM_ANISOTROPIC. If you want to use an unconstrained mapping mode, call the SetScaleToFitSize member function instead of SetScrollSizes.

Example

void CScaleView::OnUpdate( )
{
   // ...
   // Implement a GetDocSize( ) member function in 
   // your document class; it returns a CSize.
   SetScrollSizes( MM_LOENGLISH, GetDocument( )->GetDocSize( ) );
   ResizeParentToFit( );   // Default bShrinkOnly argument
   // ...
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值