代码改变世界

Visual C++ 2011-5-19

  Clingingboy  阅读(353)  评论(0编辑  收藏  举报

 

一.单选框分组

用CheckRadioButton函数将一组RadioButton设定为一组,ID为连续的

CheckRadioButton(IDC_RADIO1, IDC_RADIO3, IDC_RADIO2);

获取选中的RadioButton

int nID = GetCheckedRadioButton(IDC_RADIO1, IDC_RADIO3);

二.for循环

写法不习惯…

int i = 10;
for (; i>0; i--)
{
    Console.WriteLine(i);
}

三.ScrollWindow(Ex)

对于窗体增加ScrollBar功能

case WM_VSCROLL:
          // Get all the vertial scroll bar information

     si.cbSize = sizeof (si) ;
     si.fMask  = SIF_ALL ;
     GetScrollInfo (hwnd, SB_VERT, &si) ;

          // Save the position for comparison later on

     iVertPos = si.nPos ;

     switch (LOWORD (wParam))
     {
     case SB_TOP:
          si.nPos = si.nMin ;
          break ;
          
     case SB_BOTTOM:
          si.nPos = si.nMax ;
          break ;
          
     case SB_LINEUP:
          si.nPos -= 1 ;
          break ;
          
     case SB_LINEDOWN:
          si.nPos += 1 ;
          break ;
          
     case SB_PAGEUP:
          si.nPos -= si.nPage ;
          break ;
          
     case SB_PAGEDOWN:
          si.nPos += si.nPage ;
          break ;
          
     case SB_THUMBTRACK:
          si.nPos = si.nTrackPos ;
          break ;
          
     default:
          break ;         
     }
          // Set the position and then retrieve it.  Due to adjustments
          //   by Windows it may not be the same as the value set.

     si.fMask = SIF_POS ;
     SetScrollInfo (hwnd, SB_VERT, &si, TRUE) ;
     GetScrollInfo (hwnd, SB_VERT, &si) ;

          // If the position has changed, scroll the window and update it

     if (si.nPos != iVertPos)
     {                    
          ScrollWindow (hwnd, 0, cyChar * (iVertPos - si.nPos), 
                              NULL, NULL) ;
          UpdateWindow (hwnd) ;
     }
     return 0 ;

参考:Windows程序设计 第四章

四.关于IsDialogMessage

http://www.cnblogs.com/Greatest/archive/2009/08/25/1553623.html
http://www.cnblogs.com/lvpengms/archive/2010/02/05/1664721.html

编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示