你们说得怎么用,我用过这个,但是不行
CSize sizeTotal(20000, 30000); // 20 by 30 cm
CSize sizePage(sizeTotal.cx / 2, sizeTotal.cy / 2);
CSize sizeLine(sizeTotal.cx / 50, sizeTotal.cy / 50);
SetScrollSizes(MM_HIMETRIC, sizeTotal, sizePage, izeLine);
CSize sizeTotal(20000, 30000); // 20 by 30 cm
CSize sizePage(sizeTotal.cx / 2, sizeTotal.cy / 2);
CSize sizeLine(sizeTotal.cx / 50, sizeTotal.cy / 50);
SetScrollSizes(MM_HIMETRIC, sizeTotal, sizePage, izeLine);
解决方案 »
- 窗口如何定义自己的拥有者?
- 选择框的√ 发送什么消息可以取消掉
- 请问根据下列信息如何获得盘符?\\?\STORAGE#RemovableMedia#7&2d7cd066&0&RM#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
- VC转化为中文版本
- 24位的bmp图像如何转换为16位的?
- (顶者有分)在自己写的OCX控件中添加一个FrameWnd不响应PreTranslateMessage,OnMenuChar,如何解决
- DAO连接access数据库出现错误~~~~~
- 如何获得.doc文件中可能存在的标题和目录(29日18:00前结账)
- 查询出俩个表的不同的字段 //memo 没怎么看明白啥意思
- VC6.0中按钮控件上的数字的获取
- 如何得到当前视图的绝对坐标,即设备坐标。
- 请问为什么
http://www.csdn.net/expert/topic/590/590165.xml?temp=.9032251
里,有一段代码,你参考一下吧,或许有用。
void SetScrollSizes( int nMapMode, SIZE sizeTotal, const SIZE& sizePage = sizeDefault, const SIZE& sizeLine = sizeDefault );ParametersnMapModeThe 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.sizeTotalThe 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.sizePageThe 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.sizeLineThe 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.ResCall 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.Examplevoid CScaleView::OnUpdate( )
{
// ...
// Implement a GetDocSize( ) member function in
// your document class; it returns a CSize.
SetScrollSizes( MM_LOENGLISH, GetDocument( )->GetDocSize( ) );
ResizeParentToFit( ); // Default bShrinkOnly argument
// ...
}
在你需要的地方加入
SetScrollSizes();
小改變之後立刻呼叫 SetScrollSizes 。
<深入浅出mfc>
//CSize sizeTotal(20000, 30000); // 20 by 30 cm
//CSize sizePage(sizeTotal.cx / 2, sizeTotal.cy / 2);
//CSize sizeLine(sizeTotal.cx / 50, sizeTotal.cy / 50);
//SetScrollSizes(MM_HIMETRIC, sizeTotal, sizePage, izeLine);你这样当然是固定的啦,因为sizeTotal固定嘛!
根据文件大小计算出视图大小(需要自己写函数的,例如可以先得到行数,乘以行高(象素形式),等等)然后设置sizeTotal你们说得怎么用,我用过这个,但是不行CSize sizeTotal(Getx(),Gety());
SetScrollSizes(MM_TEXT, sizeTotal);OK!