工具栏ToolBar上的CComboBox响应回车

VC++ MFC工具栏平面下拉控件实现:自定义绘制与消息处理详解 在桌面应用开发中,控件自定义绘制是提升界面美观与交互一致性的关键技术。其原理在于通过接管系统控件的绘制过程,开发者可以完全控制其视觉表现,从而实现与应用程序主题的深度集成。这项技术的核心价值在于,它允许在不更换底层框架的前提下,为经典应用注入现代UI设计语言,显著提升用户体验。在MFC(Microsoft Foundation Classes)这类传统框架中,通过重写DrawButton等虚函数,并结合鼠标键盘消息处理,可以构建出如平面下拉控件(Flat Combo Box)这样风格统一的界面元素。本文以V 阅读详情

       在派生CToolBar类的时候, 注意如果用VC6的类向导, 类列表里是没有CToolBar的, 可以选择CToolBarCtrl, 然后手动改为CToolBar( 参考 http://support.microsoft.com/kb/99161/en-us),
//下面的代码是直接手写的
#define       IDC_COMBOBOX      11111
class CToolBarEx : public CToolBar
{
     .........//其他的类代码省略
    CComboBox   m_Combo;
    afx_msg void OnSelectComboBox();
    DECLARE_MESSAGE_MAP()
};

BEGIN_MESSAGE_MAP(CToolBarEx, CToolBar)
      ON_CBN_SELENDOK(ID_COMBOBOX, OnSelectComboBox)
END_MESSAGE_MAP()

void CToolBarEx::OnSelectComboBox()
{
}
      在上面的一小段代码中, 我们添加了对CBN_SELENDOK消息的处理, 这个消息是CComboBox在完成选择后
发送给父窗口的. 处理回车还需要在用户的VK_RETURN消息里模拟发送出这个CBN_SELENDOK消息.

      所以我们还需要处理PreTranslateMessage函数.函数在类头文件的声明略.
BOOL CToolBarEx::PreTranslateMessage(MSG* pMsg)
{
       if (pMsg->message == WM_KEYDOWN)
       {
              NMHDR nm;  
              nm.hwndFrom = m_hWnd;
              nm.idFrom = GetDlgCtrlID();
              nm.code = NM_RETURN;
              switch (pMsg->wParam)
              {
              case VK_RETURN:
                     //发送通知消息
                     if( m_Combo.IsChild(GetFocus()) )
                     OnSelectComboBox();
                     GetOwner()->SendMessage(WM_NOTIFY, nm.idFrom, (LPARAM)&nm);
                     return TRUE;
  }
 }
 return CToolBar::PreTranslateMessage(pMsg);
}

行测测评——矩阵、圆形、环形三角图形数列推理解题技巧 写在前面:各大公司的测评做的让人眼花缭乱,很多题型都是第一次见,比如逻辑关系、信息推理,最难的要属找规律的数字推理了。根据B站UP主刘文超老师的课程,记录一下解题技巧。感谢UP主的无私奉献,原地址连接:https://www.bilibili.com/video/BV1it411M7o2?t=528&p=7 解题技巧: 从图形的上下、左右、交叉 角度进行尝试求解 基本法则是“加、减、乘、除、倍数、次方”六种形态。 一、有心数阵 解题技巧:周边数字通过某种运算得到中间数字 1.周边数.. 阅读详情

相关推荐

手把手教你解决Windows 10网络驱动器无法访问问题(附详细排查步骤)

本文详细指导Windows 10用户解决网络驱动器无法访问的常见问题。通过从现象快速定位到系统排查,提供了从检查网络连通性、修复凭据权限到调整高级设置的完整步骤,特别是针对“找不到网络路径”等错误,帮助用户高效恢复对共享资源的访问。

weixin_29233857的博客 525

工具栏中嵌入Combo Box

1.在资源视图的toolbar资源的IDR_MAINFRAME中找一个放置combo box控件的地方,将它的ID设置为ID_COMBO 2.利用类向导创建下面这个类: class CToolBarWithCombo : public CToolBar { public: CComboBox m_comboBox; // Overrides // ClassWizard ge

u013094443的博客 1442

QT的温湿度显示系统

大家好,这里是石侃侃的博客,欢迎前来讨论这篇文章介绍的是DHT11在2440上的基于Qt5.6的应用基于单片机系统的温湿度监测系统构成框图如图2-1所示。图2-1 系统构成框图该系统采用单片机s3c2440作为了本设计的核心元件。利用LCD作为了显示器件,利用触摸屏作为用户界面输入设备,第一行显示当前实时的温度,湿度,第二行依次显示历史时刻最高的温度值,最高的湿度值。第三行是一个文本框,记录了程...

zxpcus的博客 1万+

MFC工具条CToolBar添加非按钮控件CComboBox

继承CWnd的类都能放到工具条上。原理:1.在工具条资源添加分隔符SEPARATOR2.设置分隔符宽度3.得到分隔符窗口CRect4.根据分隔符窗口创建Create组合框ComboBox新手要源码,留下邮箱。补充:工程大的时候,需要清理状态才能正确显示,曾被困惑好久。App里加CleanState();或直接删除注册表。一、打开.rc文件修改如下://///////////////////////...

weixin_34097242的博客 251

HFSS实战(二)——精准仿真高速PCB差分线的信号完整性

本文深入探讨了使用HFSS进行高速PCB差分线信号完整性仿真的关键技术与实战经验。从设计文件导入、模型裁剪到差分端口设置,详细解析了精准仿真的全流程,特别强调了材料特性和3D电磁场仿真在解决微带线损耗等问题中的重要性。文章还提供了常见问题排查指南和效率优化技巧,帮助工程师提升高速PCB设计的仿真精度与效率。

weixin_38170829的博客 582

智能客服系统知识库数据清洗

数据清洗(Data Cleaning)是确保智能客服知识库高效运行的重要环节,主要涉及。| 分类 & 标签优化 | 重新组织 FAQ,创建关键字索引 || 定期更新 | 结合用户反馈,每 1-3 个月优化 |才能提供更优质、正确的回答,提升客户满意度!、Zendesk、Intercom 等)中,: FAQ 或客服回答中可能存在。,会影响 AI 匹配的准确性。是一个持续优化的过程,

z1941563559的博客 2106

MFC 工具条 CToolBar : 添加控件

MFC 工具条 CToolBar 添加非按钮控件CComboBox  工具栏添加组合框 继承CWnd的类都能放到工具条上。 原理: 1.在工具条资源添加分隔符SEPARATOR 2.设置分隔符宽度 3.得到分隔符窗口CRect 4.根据分隔符窗口创建Create组合框ComboBox 新手要源码,留下邮箱。 补充: 工程大的时候,需要清理状态才能正确显示,曾被困惑好久

路楷的专栏 929

IDEA 2023最新破解教程:从安装到永久激活(附常见问题解决方案)

本文为Java开发者提供了一份详尽的IntelliJ IDEA 2023高效使用指南。内容涵盖从版本选择、安装配置到核心快捷键、项目依赖管理、高级调试测试以及插件生态的深度优化。旨在帮助用户在合法合规的前提下,充分发挥这款顶级IDE的潜力,显著提升Java开发效率与工作体验。

time3的博客 3535

CComboBox 下拉框自适应宽度,添加消息响应CBN_DROPDOWN AdjustComboBoxDropDownListWidth()

MFC ComboBox空间 下拉框宽度根据内容自适应

baidu_33308136的博客 840

PCL Super4PCS算法实现点云粗配准(版本一)【2025最新版】

Win11系统下实现[Super4PCS: Fast Global Pointcloud Registration via Smart Indexing一文中的配准算法。

点云侠的博客 3381

YOLOv11改进策略【模型轻量化】| 替换骨干网络为 GhostNet V3 2024华为的重参数轻量化模型

一、本文介绍 本文记录的是基于 GhostNetV3 的 YOLOv11 轻量化改进方法研究。GhostNetV3的轻量模块采用重参数化方法,训练时为深度可分离卷积和1×1卷积添加线性并行分支,推理时通过逆重参数化移除分支、折叠操作,能够在不增加推理成本的同时提高性能,从而实现YOLOv11的轻量化改进。 专栏目录:YOLOv11改进目录一览 | 涉及卷积层、轻量化、注意力、损失函数、Backbone、SPPF、Neck、检测头等全方位改进 专栏地址:YOLOv11改进专栏——以发表论文的角度,快速

Limiiiing的博客 1851

工具栏上创建ComboBox组合框控件,框架响应消息

点击打开链接 由于业务需要,在原有程序的基础上需要增加几项新的功能。主程序是没有顶部菜单的MDI窗口,考虑在多视环境下的操作实现比较麻烦,故采用主框架响应组合框的消息函数。 创建ComboBox控件 步骤: 1〉在资源里添加一个按钮,命名为ID_COMMBO。 2〉、添加新类class CComboToolBar, class CComboToolBar : public

h_h_w的专栏 1655

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

vc++MFC设置Combo box下拉选择改变事件,解决想响应一个下拉框ComboBox控件选择改变的事件时,但总在下一次选择改变时才触发上次的响应问题。

3、在事件函数中添加:int index =((CComboBox*)GetDlgItem(IDC_COMBO1))->GetCurSel();//获取所选项的索引。//设置改变事件为所选项索引。2、选择组合框右击,选择事件,添加事件函数CBN_SELCHANGE。//更新,获得所选项索引。1、打开MFC添加组合框。

weixin_45948117的博客 3074

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

CComboBox使用技巧

 CComboBox使用技巧: 1. CComboBox风格      CBS_AUTOHSCROLL //自动水平滚动条CBS_DISABLENOSCROLL //选中时始终显示滚动条CBS_DROPDOWN //下拉式CBS_DROPDOWNLIST //下拉列表CBS_HASSTRINGS

无幻 6961

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

VS2010/MFC编程入门之二十四(常用控件:组合框控件Combo Box)

上一节鸡啄米讲了列表框控件ListBox的使用,本节主要讲解组合框控件Combo Box。组合框同样相当常见,例如,在Windows系统的控制面板上设置语言或位置时,有很多选项,用来进行选择的控件就是组合框控件。它为我们的日常操作提供了很多方便。        组合框控件简介        组合框其实就是把一个编辑框和一个列表框组合到了一起,分为三种:简易(Simple)组合框、下拉式

Cesar Wu 2563

ComboBox接受回车事件

<br />ComboBox接受回车事件的两种方法:<br />第一种:可以override窗体Form的ProcessDialogKey来抓回车<br />//拷贝到Form类中。 <br />protected   override   bool   ProcessDialogKey(System.Windows.Forms.Keys     aKey) <br />{ <br />if   (aKey   ==   Keys.Enter) <br />{ <br />if   (this.comboB

顾传龙 4804

combobox 处理回车

combobox控件,由一个edit编辑框和一个下拉列表框组成。  BOOL   CTest6Dlg::PreTranslateMessage(MSG*   pMsg)       {         if(   pMsg->message   ==   WM_KEYDOWN   )     {                     switch(   pMsg->wParam   )  

wwwcs59的专栏 1812

mfc控件总览(转)

 1。mfc单文档结构2。添加 左击鼠标,按下键盘事件3。消息:窗口消息,控件的通知消息,命令消息第5章对话框和常用控件 5.1 对话框的使用 5.2 控件的创建和使用方法 5.3 常用控件 5.4 通用对话框和消息对话框 5.1对话框的使用5.1.1模式和无模式对话框 Ø    模式对话框 u      指当对话框被弹出,用户必须在对话框中作出

lxf20054658的专栏 1万+
上一篇: 用VC制作非常酷的工具条
下一篇: 界面库技术概述
skyremember
博客等级 码龄20年 205粉丝 484原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值