程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> .NET實例教程 >> CScrollView::SetScrollSizes簡要用法

CScrollView::SetScrollSizes簡要用法

編輯:.NET實例教程

MSDN :

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.

sizeTotal  //SCrollbar的顯示范圍,含不在視區顯示部分的大小
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 //當點擊Scrollbar空白條時,視區移動得大小
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 //點擊SCrollbar的上下左右按鈕時,視區移動的大小
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.

 如下實例:



void CEx04cVIEw::OnInitialUpdate()
...{
        CScrollVIEw::OnInitialUpdate();
        CSize sizeTotal(20000, 30000); // 20 by 30 cm
        CSize sizePage(sizeTotal.cx / 4, sizeTotal.cy / 4); //當點擊Scrollbar空白條時,視區移動得大小
        CSize sizeLine(sizeTotal.cx / 20, sizeTotal.cy / 20); //點擊SCrollbar的上下左右按鈕
        SetScrollSizes(MM_TEXT, sizeTotal, sizePage, sizeLine);
}

再來看下這裡的CSize,MSDN :

CSize(
   int
initCX,
   int
initCY
)

Parameters

initCX
Sets the cx member for the CSize.
initCY
Sets the cy member for the CSize

VC技術內幕:CSize對象可以看成是兩個CPoint對象的差

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved