博客
关于我
CComboBox使用技巧
阅读量:159 次
发布时间:2019-02-27

本文共 2105 字,大约阅读时间需要 7 分钟。

 CComboBox使用技巧: 


1. CComboBox风格     

  


2. 初始化数据

   1).在Combo Box控件属性的Data标签里面添加,一行表示Combo Box下拉列表中的一行。换行用ctrl+回车。

 

   2).在程序初始化时动态添加

 


3. 删除指定行

 


 

4.插入指定位置

 


 

5.删除所有项


6.查找指定字符串

 


 

7.选择其中某行

 


 

8.获取总行数


 

9.取得Combo Box框内容

 


 

10.获得焦点

通常要判断控件是否获得了焦点,可以用GetFocus()函数

例如:if(GetFocus()==GetDlgItem(IDC_EDIT_VALUE2))//判断焦点是否在编辑框IDC_EDIT_VALUE2内。
但是combobox 的焦点不同,因为它是由edit和listbox两部分组成的,所以获得焦点要用GetParent():

 


 

11.改变下拉框大小

    在设计界面里,点击一下Combo Box的下拉箭头,此时出现的调整框就是Combo Box的下拉调整框


12.常用消息映射宏

   ON_CBN_DBLCLK                 鼠标双击

   ON_CBN_DROPDOWN          列表框被弹出
   ON_CBN_KILLFOCUS / ON_CBN_SETFOCUS     在输入框失去/得到输入焦点时产生
   ON_CBN_SELCHANGE         列表框中选择的行发生改变
   ON_CBN_EDITUPDATE        输入框中内容被更新
   使用以上几种消息映射的方法为定义原型如:afx_msg void memberFxn( );的函数,并且定义形式如ON_Notification( id, memberFxn )的消息映射。
   如果在对话框中使用组合框,Class Wizard会自动列出相关的消息,并能自动产生消息映射代码。

转载地址:http://pjid.baihongyu.com/

你可能感兴趣的文章
NMF(非负矩阵分解)
查看>>
nmon_x86_64_centos7工具如何使用
查看>>
NN&DL4.1 Deep L-layer neural network简介
查看>>
NN&DL4.3 Getting your matrix dimensions right
查看>>
NN&DL4.7 Parameters vs Hyperparameters
查看>>
NN&DL4.8 What does this have to do with the brain?
查看>>
nnU-Net 终极指南
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
NO 157 去掉禅道访问地址中的zentao
查看>>
no available service ‘default‘ found, please make sure registry config corre seata
查看>>
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
查看>>
no connection could be made because the target machine actively refused it.问题解决
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>
No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
查看>>
No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
查看>>
No mapping found for HTTP request with URI [/logout.do] in DispatcherServlet with name 'springmvc'
查看>>
No module named 'crispy_forms'等使用pycharm开发
查看>>
No module named 'pandads'
查看>>