duilib 滑块移动消息实时获取

来源:互联网 发布:矩阵行列式的计算 编辑:程序博客网 时间:2024/06/05 05:58

我的实现方法

查找到Slider控件,设置控件的 m_bImmMode 为true
处理Notify消息中 valuechanged 消息
具体剪辑代码如下

CSliderUI* sld = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("AdjustColorSliderR")));if (sld) {    sld->SetImmMode(true);}if (msg.sType == DUI_MSGTYPE_VALUECHANGED) {            DUITRACE(_T("%s"), msg.sType);            return;}

这里写图片描述

网上通过自定义控件的方式实现

两种方法都可以实现,不存在优劣,各自的方法可以实现自己技术的修炼,不过我是各倾向于少写代码,实现尽可能重用。

列表框单选按钮COptionUI,按钮定义为 group=”switch” 库会自动将其它开关设置为关,只设置一个为开

<?xml version="1.0" encoding="UTF-8"?><Window>  <ListContainerElement>    <HorizontalLayout  height="62"  >      <VerticalLayout >        <HorizontalLayout>          <Label name="nickname" bordersize="0" width="260" textcolor="#FF000000" disabledtextcolor="#FF808080" />          <Label name="description" bordersize="0" textcolor="#FF808080" />        </HorizontalLayout>      </VerticalLayout>       <VerticalLayout name="logo_container" width="54" padding="30,11,10,11">        <option name="logo" group="switch" width="54" height="22" normalimage="switch_off.png"  selectedimage="switch_on.png"/>      </VerticalLayout>      <VerticalLayout name="operation" height="16" visible="false">      </VerticalLayout >    </HorizontalLayout>  </ListContainerElement></Window>

duilib深度解析

duilib 窗口禁止最大化

duilib窗口拖动功能

duilib不规则窗口

duilib常用属性