尧图网站建设 尧图网络
  • 首页
  • 关于我们
  • 服务项目
  • 案例展示
  • 建站流程
  • 资讯中心
  • 联系我们
首页/资讯中心/详情

Combo-box Control - ComboExo example

Combo-box Control - ComboExo example
📅 发布时间:2026/6/19 18:17:34

Combo-box Control - ComboExo example

Create a new ComboExo using VS2013

  • MFC Application Wizard
  • design dialog
  • event

ComboExo example - visualc

The original example was written using VC6.0; now we will rewrite it using VS2013.
After downloading, click "Extract" to extract the source files.

Move files to the "res" directory:

  • res/ComboExo.ico
  • res/ComboExo.rc2

Recompile with Visual Studio 2015+

D8016 '/ZI' and '/Gy-' command-line options are incompatible

C/C++ -> General -> Debug Information Format

Program Database(/Zi)

MFC Application Wizard

  • Application Type
  • User Interface Features

default

  • Advanced Features

Cancel All

Application Type - Dialog based

  • Project style:

MFC standard

  • Dialog based options:

none

design dialog

Drag and drop from the toolbox:

  • Combo box
  • Edit Control

List height

There are two ways to adjust the list height:

  1. Drag the "down arrow"
    MFCApplication1-combobox
  2. Configure the rc file
    Original data:
COMBOBOX        IDC_COMBO1,58,39,48,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP

new data: Height of the 4 items

COMBOBOX        IDC_COMBO1,58,39,48,48,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP

event

  • CBN_SELCHANGE

IDC_COMBO1 -> Properties

  • OnInitXXX

CBN_SELCHANGE

Click the "CBN_SELCHANGE" event property and select " OnCbnSelchangeCombo1" from the drop-down menu.
MFCApplication1-combobox1

void CComboExoDlg::OnCbnSelchangeCombo1()
{// TODO: Add your control notification handler code hereCString strTemp;int nCurSel;nCurSel = ((CComboBox*)GetDlgItem(IDC_COMBO1))->GetCurSel();((CComboBox*)GetDlgItem(IDC_COMBO1))->GetLBText(nCurSel, strTemp);GetDlgItem(IDC_EDIT1)->SetWindowText(strTemp);
}

OnInitDialog()

// Add 20 items to the combo box.
CString str;
for (int i = 0; i < 20; i++)
{str.Format(_T("item string %d"), i);((CComboBox*)GetDlgItem(IDC_COMBO1))->AddString(str);
}

相关新闻

  • P3209 [HNOI2010] 平面图判定
  • 强化学习基础概括
  • 2025 成都律师咨询最新推荐榜权威发布:聚焦刑事辩护与民商事领域,资深团队与新锐品牌全景解析

最新新闻

  • 2026苏州钻石回收实测|国标4C定级,全城无套路靠谱门店变现指南 - 薛定谔的梨花猫
  • C语言宽字符处理:wmemcmp、wmemcpy、wprintf核心函数详解与实战
  • 多模态大语言模型LISA
  • 2026长沙回收百达翡丽手表门店分级指南,一线标杆店铺评级,区分正规与小作坊 - 名奢变现站
  • 如何通过WeChatMsg实现微信聊天记录的本地化解析与数据主权保护?
  • 告别GUI开发噩梦:用Dear ImGui在30分钟内为C++项目添加专业界面

日新闻

  • 5分钟掌握Python进化算法:Geatpy高性能优化工具完全指南
  • Microchip 24AA044 EEPROM选型与应用全指南:从参数解析到实战编程
  • 华为的鸿蒙到底有多牛?为什么称作遥遥领先?

周新闻

  • 3步解锁iOS设备:applera1n激活锁绕过完全指南
  • 39 2026 人工智能证书终极盘点,普通人选 AI 证书可以从这些方向入手
  • Redis 暴露公网有多危险?从端口检查到补救步骤

月新闻

  • 【总结】入门篇:50句话让你记住架构核心概念
  • WeChatMsg技术方案解析:实现Mac微信数据自主管理的完整解决方案
  • WeChatMsg:革新性微信数据备份方案,打造你的专属数字记忆库

关于尧图

  • 公司简介
  • 团队介绍
  • 企业文化
  • 荣誉资质

服务项目

  • 定制开发
  • 电商建站
  • UI 设计
  • 运维服务

快速链接

  • 案例展示
  • 建站流程
  • 常见问题
  • 资讯中心

联系方式

  • 📍北京市朝阳区互联网产业园 A 座 10 层
  • 📞400-888-8888
  • ✉️contact@rkmt.cn
  • 🕐周一至周日 9:00-21:00

© 2024 北京尧图网络科技有限公司 版权所有 | 京 ICP 备 XXXXXXXX 号