CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  界面

巨难的问题,关于滚动条的问题?水能解决?

楼主lizhyifeng(licsdn)2004-11-03 01:36:45 在 VC/MFC / 界面 提问

为什么我在程序初始化时:  
        SCROLLINFO   info;  
        info.cbSize   =   sizeof(SCROLLINFO);            
        info.fMask   =   SIF_ALL;            
        info.nMin   =   0;    
        info.nMax   =   50;  
        info.nPage   =   5;          
        info.nPos   =   10;  
        info.nTrackPos   =   1;  
        m_ScrollBar.SetScrollInfo(&info);  
   
  而当点击滚动条,产生消息时:  
  OnVScroll(UINT   nSBCode,   UINT   nPos,   CScrollBar*   pScrollBar)    
  {  
  //   TODO:   Add   your   message   handler   code   here   and/or   call   default  
   
  //   Get   the   minimum   and   maximum   scroll-bar   positions.  
        int   minpos;  
        int   maxpos;  
        int   maxpos1;  
        m_scbVert.GetScrollRange(&minpos,   &maxpos);        
        maxpos1   =   m_scbVert.GetScrollLimit();  
   
  为什么:  
        此时minpos=0,   maxpos=50  
          而maxpos1   =31  
  为什么:maxpos与maxpos1不相等。  
  怎样才能使maxpos1等于maxpos。  
   
  我本意是想点击50次,滚动条才到达底端,可现在点击33次就到达底端了,改怎样避免这种情况你。也就是实现点击50次才到达底端。  
   
  问题点数:0、回复次数:3Top

1 楼haizhiyu(海之鱼)回复于 2004-11-03 09:20:03 得分 0

滚动条滚动次数=(总数-当前客户区大小)/每次滚动大小Top

2 楼yuantao(cfan)回复于 2004-11-03 17:20:07 得分 0

SCROLLINFO   info;  
        info.cbSize   =   sizeof(SCROLLINFO);            
        info.fMask   =   SIF_ALL;            
        info.nMin   =   0;    
        info.nMax   =   50;  
        info.nPage   =   5;          
        info.nPos   =   10;  
        info.nTrackPos   =   1;  
        m_ScrollBar.SetScrollInfo(&info);  
   
  你的这段代码有问题,   把nPos改为0,    
  nMin    
  Specifies   the   minimum   scrolling   position.    
  nMax    
  Specifies   the   maximum   scrolling   position.    
  nPage    
  Specifies   the   page   size.   A   scroll   bar   uses   this   value   to   determine   the   appropriate   size   of   the   proportional   scroll   box.    
  nPos    
  Specifies   the   position   of   the   scroll   box.    
  nTrackPos    
  Specifies   the   immediate   position   of   a   scroll   box   that   the   user   is   dragging.   An   application   can   retrieve   this   value   while   processing   the   SB_THUMBTRACK   request   code.   An   application   cannot   set   the   immediate   scroll   position;   the   SetScrollInfo   function   ignores   this   member.    
  Top

3 楼yuantao(cfan)回复于 2004-11-03 17:21:49 得分 0

 
  The   maximum   value   that   a   scroll   bar   can   report   (that   is,   the   maximum   scrolling   position)   depends   on   the   page   size.   If   the   scroll   bar   has   a   page   size   greater   than   one,   the   maximum   scrolling   position   is   less   than   the   maximum   range   value.   You   can   use   the   following   formula   to   calculate   the   maximum   scrolling   position:  
   
  MaxScrollPos   =   MaxRangeValue   -   (PageSize   -   1)    
   
  msdn上说的很明白.Top

相关问题

  • 水平滚动条问题
  • 如何使CTreeCtrl能垂直滚动,但不能水平滚动?
  • 如何给listbox回水平滚动条??
  • listbox增加水平滚动条
  • JTextPane如何加水平的滚动条
  • 怎么让listbox有水平滚动条?
  • sos:谁有水平滚动字模类
  • datagrid水平滚动条不行?why?
  • 如何给listbox加水平滚动条?
  • datalist里内容水平滚动问题

关键词

  • maxpos
  • scrolling
  • ntrackpos
  • scrollinfo
  • setscrollinfo
  • npos
  • minpos
  • npage
  • info
  • nmax

得分解答快速导航

  • 帖主:lizhyifeng

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo