CScrollView::SetScrollSizes

来源:互联网 发布:淘宝不支持国际转运 编辑:程序博客网 时间:2024/05/19 20:38

Call SetScrollSizes when the view is about to be updated. //当视图准备被更新的时候调用该函数

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 Mode

Logical Unit

Positive y-axis Extends...

MM_TEXT

1 pixel

Downward

MM_HIMETRIC

0.01 mm

Upward

MM_TWIPS

1/1440 in

Upward

MM_HIENGLISH

0.001 in

Upward

MM_LOMETRIC

0.1 mm

Upward

MM_LOENGLISH

0.01 in

Upward

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.

所有的这些模式被Windows定义。两个标准的影射模式:MM_ISOTROPIC 和 MM_ANISOTROPIC,在CScrollView中没有被使用。类库为滚动视图的大小到窗口的尺寸提供了SetScaleToFitSize成员函数。表中的第三列描述了坐标定位。

sizeTotal

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

滚动视图的总尺寸。cx控制水平范围,cy控制垂直范围,cy必须大于等于零。

sizePage

The horizontal and vertical amounts to scroll in each direction in response to a mouse click in a scroll-bar shaft. Thecx 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. Thecx member contains the horizontal amount. The cy member contains the vertical amount.

对于鼠标在滚动箭头上一次单击做出向水平和竖直方向滚动的量的反应。

Remarks

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 calledGetMyDocSize, that you supply with your derived document class. The following code shows this approach:

当,例如文档初始显示或者是当文档更改了大小的时候,在你覆盖的OnUpdate成员函数中调用该函数用来调整放缩特征。你通常可以从视图的关联文档通过调用一个文档的成员函数来获取尺寸信息,也许是调用GetMyDocSize,这个函数被你集成的文档类所提供。下面的代码展示了这种方法:

Visual C++ Copy Code
CMyScrollDoc* pMyDoc = (CMyScrollDoc*)GetDocument();SetScrollSizes(nMapMode, pMyDoc->GetMyDocSize());

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

或者,你也许有时会需要设置一个固定的尺寸,如下面代码所示:

Visual C++ Copy 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 theSetScaleToFitSize member function instead of SetScrollSizes.

必须为窗口映射模式设置映射模式,影射模式排除MM_ISOTROPIC 和 MM_ANISOTROPIC。如果想要使用一个无约束的映射模式,调用SetScaleToFitSize成员函数来代替SetScrollSizes