C++ Code_ScrollBar
|
主题 |
|
1. ScrollBar的使用 2. 3. 4. 5. |
|
属性 |
|
HScrollBar VScrollBar 直接拖拽1其中任意空间到对话框上面是,你一拖拽滚动条,它立即回到原始位置 |
|
代码:: |
|
/* 在控件上面添加1个HScrollBar和1个Edit控件
*/ //初始化部分添加代码 // TODO: Add extra initialization
here CScrollBar *pScroll=(CScrollBar*)GetDlgItem(IDC_SCROLLBAR1);
pScroll->SetScrollRange(0, 100);
pScroll->SetScrollPos(0);
SetDlgItemInt(IDC_EDIT1, 0); //为对话杠添加1个OnHScroll消息,添加如下代码 void CProject01Dlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or
call default int iPos=pScrollBar->GetScrollPos();
switch (nSBCode)
{
case SB_LINERIGHT:
iPos+=1;
break;
case SB_LINELEFT:
iPos-=1;
break;
case SB_PAGERIGHT:
iPos+=10;
break;
case SB_PAGELEFT:
iPos-=10;
break;
case SB_THUMBTRACK:
iPos=nPos;
break;
default:
break;
}
if (iPos<0) iPos=0;
if (iPos>100) iPos=100;
pScrollBar->SetScrollPos(iPos);
SetDlgItemInt(IDC_EDIT1, iPos);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
} //为Edit1添加OnChange消息 void CProject01Dlg::OnChangeEdit1()
{
// TODO: If this is a RICHEDIT control, the control
will not // send this notification unless you override the
CDialog::OnInitDialog() // function and call
CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the
mask. CString STR;
GetDlgItemText(IDC_EDIT1, STR);
STR.TrimLeft();
STR.TrimRight();
INT iPos=0;
if (STR!="-"
&& STR!="") {
if
(!UpdateData()) {
return;
}
iPos=m_nEdt1;
}
CScrollBar *pScroll=(CScrollBar*)GetDlgItem(IDC_SCROLLBAR1);
pScroll->SetScrollPos(iPos);
// TODO: Add your control notification handler code
here }
效果图:
|
附件列表
C++ Code_ScrollBar的更多相关文章
随机推荐
- Quartz使用总结
废话的前言 以前凭借年轻,凡事都靠脑记.现在工作几年后发现,很多以前看过.用过的东西,再次拿起的时候总觉得记不牢靠."好记性不如烂笔头"应该是某位上了年纪的大叔的切肤之痛(仅次于上 ...
- C语言基础(不断更新)
1.memcpy. memmove.memccpy的区别 字符串函数功能查询 memcpy要求源串和目的串不能重叠 memccpy:copy直至遇到由参数指定的ch. memmove: 源串和目的串可 ...
- [WebService]之代码优先方法与契约优先方法
什么是 web 服务? web 服务是对应用程序功能的网络访问接口,它是使用标准 Internet 技术构建的. 我们目前看到的部署在 Internet 上的 web 服务都是 HTML 网站.其中, ...
- INTEL XDK 真机调试
需要安装 1.google服务框架 2.google play 3.app preview
- 消除QQ表情小游戏
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- 轻松学习Linux之VI编辑器的使用
本文出自 "李晨光原创技术博客" 博客,谢绝转载!
- Supports BorlandIDEServices
Delphi: procedure SetKeystrokeDebugging(Debugging: Boolean); var Dialog: IOTAKeyboardDiagnostics beg ...
- fdquery update
fdquery update this->FDQuery1->CachedUpdates; this->FDQuery1->UpdateOptions->KeyFiel ...
- 使用IIS6.0遇到问题后,常用的几种解决方法
1.检查 .Net Framework,是否安装完全,不确定的情况下使用:aspnet_regiis.exe -i 或者 aspnet_regiis.exe -r 2.检查 IIS 6.0 其它相关配 ...
- Windows下Mysql5.6启用监控执行脚本的日志
修改my.ini (我的MySQL安装位置是:E:\MySQL\MySQL Server 5.6) log-output=FILE general-log=1 general_log_file=&qu ...

