• CSpinButtonCtrl数字调节控件


    CSpinButtonCtrl常用属性

    CSpinButtonCtrl类常用成员函数

    CSpinButtonCtrl代码示例

     

    一、CSpinButtonCtrl控件属性

    1.添加EDIT控件
    2.添加Spin控件
       如果不是这样的顺序的话,使用ctrl+D改变Tab顺序,使spin紧靠edit后面
    3.在EDIT控件上面设置group属性(特别注意)
    4.设置Spin属性

    Auto Buddy 为     //为 true 表示按Z序自动关联一个伙伴窗口

    Set Buddy Integer  //为 true 表示在伙伴窗口上显示数值
        Alignment 为 Right Align  //表示spin控件在伙伴窗口中右对齐

    Orientation   // 水平,还是垂直

    Wrap        //数值超过范围时循环数值超过范围时循环

    Arrow keys   //为True(当按下向上和向下方向键时,控件可以增加或减小)



    二、CSpinButtonCtrl类常用成员函数

      

    SetAccel

    为spin按钮设置一个加速值。

    GetAccel

    Retrieves acceleration information for a spin button control.

    SetBase

    此成员函数用来设置一个旋转按钮控件的基数。这个基数值决定了伙伴窗口显示的数字是十进制的还是十六进制的。十六进制的数总是无符号的;十进制的数是有符号的。

    GetBase

    Retrieves the current base for a spin button control.

    SetBuddy

    为spin按钮设置一个伙伴窗口,点击spin按钮时焦点会落在这个伙伴窗口上

    GetBuddy

    Retrieves a pointer to the current buddy window.

    SetPos

    为spin控件设置一个当前位置。

    GetPos

    Retrieves the current position of a spin button control.

    SetRange

    设置范围值。

    GetRange

    Retrieves the upper and lower limits (range) for a spin button control.

    SetRange32

    设置32位的范围值

    GetRange32

    Retrieves the 32-bit range for a spin button control.

     

    三、代码示例

              // CDialog_SPIN_Test 消息处理程序

    int CDialog_SPIN_Test::OnInitDialog(void)

    {

             CDialog::OnInitDialog();

             //获取对象指针

             CSpinButtonCtrl* pSpin=(CSpinButtonCtrl*)GetDlgItem(IDC_SPIN1);

             CEdit* pedt=(CEdit*)GetDlgItem(IDC_EDIT2);

             pSpin->SetRange32(0,1000);//设置范围

             pSpin->SetBase(10);//设置基数,进制或者进制显示

             pSpin->SetBuddy(pedt);//设置合作者窗口

             UDACCEL a[2];//for

             a[0].nSec=1;

             a[0].nInc=1;

             a[1].nSec=3;

             a[1].nInc=20;

             pSpin->SetAccel(2,a);//设置加速度

             return 0;

    }

  • 相关阅读:
    最近看到C#里面的抽象类和接口,还有索引器。
    Memcached服务端自动启动
    python操作MySQL数据库
    Linux开放端口
    关于数组的几道面试题
    这群超酷的开发者,是如何轻松搞定软件开发?
    五分钟开发好你的第一个人工智能应用
    Case Study: 技术和商业的结合点在哪里?
    【江湖趣事】话说开源界和微软的那些往日恩怨
    评微软收购GitHub
  • 原文地址:https://www.cnblogs.com/15157737693zsp/p/3840286.html
Copyright © 2020-2023  润新知