VC RadioBox[转]

MFC RadioButton用法 1 新建对话框程序,添加几个单选按钮,如下 2.Radio Button是单选按钮,同组之间是互斥的。但我们选择了“男”,然后再去选择“女”时,“男”就会取消选择,这也是我们想要的。但是当我们再去选择“5岁”时,女又会被取消选择,但这可不是我们想要的。为了第一题和第二题之间互相没有影响,我们需要分组。Radio Button有个属性Group,默认值是“False”。我们可以将某一个Ra 阅读详情

 

VC 2007-11-08 14:23:29 阅读34 评论0字号:大中小

先为对话框加上2个radio button,分别是Radio1和Radio2。

问题1:如何让Radio1或者Radio2默认选上?如何知道哪个被选上了?

关键是选上,“默认”只要放在OnInitDialog()即可。三种方法可以让它选上,
第一种:
((CButton *)GetDlgItem(IDC_RADIO1))->SetCheck(TRUE);//选上
((CButton *)GetDlgItem(IDC_RADIO1))->SetCheck(FALSE);//不选上
((CButton *)GetDlgItem(IDC_RADIO1))->GetCheck();返回1表示选上,0表示没选上
第二种:
关联一个congtrol型变量(子类化),好ctrl+W(即打开classwizard),点开 Member Variables,咦?怎么没有IDC_RADIO1这个ID?原来是没有分组。因为radio button通常都是成组使用的,在一组里面是互斥的。取消,回到对话框资源面板,右键Radio1查看属性把Group选上,那么,Radio1和 Radio2就是一组了(怎么知道他们是一组的?后面说)。此时,就可以为Radio1增加一congtrol型变量m_ctrlRadio1了。如下:
m_ctrlRadio1.SetCheck(TRUE);
同样可以使用GetCheck()获取状态。
第三种:
关联一个int型变量(同样需要先分组)m_nRadio1,打开对话框构造函数,你会发现有:
m_nRadio1 = -1;m_nRadio1别赋值-1表示哪个都没有选上。如果你把-1改成0,就会发现Radio1默认被选上了,依此类推,m_nRadio1的值为1 就是第二个被选上了(这里同样有问题,哪个是第一个?哪个是第二个?)。获取状态很简单,UpdateData(TRUE)后判断m_nRadio1的值即可。

问题2:如何使用多组?

多组和一组是一样的使用,只要搞清楚哪个是哪一组的就行了。再为对话框添加Radio3和Radio4。很简单,先为这些Radio Button排个顺序,就是排列他们的TAB ORDER。在对话框资源面板上Ctrl+D,然后按你自己的理想顺序用鼠标逐个点击就可以了。不妨假设Radio1、Radio2、Radio3、 Radio4分别是1、2、3、4。Radio1和Radio3都选上Group属性,那么,1、2是一组,3、4是另外一组,因为分组的原则是在选上 Group属性的这一个开始直到碰到下一个选上Group属性的。你不妨再Ctrl+D,令Radio1、Radio2、Radio3、Radio4分别是1、3、2、4,那么Radio1和Radio3是一组,如果m_nRadio1=1,此时是Radio3被选上而不是Radio2被选上。分好了组就分别使用它们吧。

嗯,也许你还要为它们添加鼠标单击事件,非常简单。

vue3 antd项目实战——radiogroup单选组合、radiobutton单选按钮【v-model双向绑定数据、v-for循环输出options选择项】 一文带你学会vue3 ant design vue项目实战——Radio单选框【后台管理系统 v-model双向绑定、v-for循环输出】 阅读详情

相关推荐

VC6环境下Radiobox使用指南

Radiobox,也称为单选按钮,是图形用户界面中的一种常用控件,允许用户从一组互斥选项中进行单一选择。在VC6.0开发环境中,使用MFC(Microsoft Foundation Classes)构建应用程序时,Radiobox控件扮演着不可或缺的角色。它特别适用于需要用户从两个或更多选项中作出不兼容选择的场景。MFC采用消息映射机制来处理来自系统的消息,比如用户输入或者系统事件。控件事件(比如点击Radiobox)被转换成消息,然后发送到相应的窗口处理函数。

weixin_35238815的博客 1113

MFC radio button 的用法

1.画控件: 把控件拖入对话框,并命名,如上图所示。 2.分组: 分组前要将按钮排序,如图所示。保证同一组内的radio的tab序号是连续的。 然后设定每组第一个RadioButton的Group属性为TRUE,分组完成,即从当前设置Group属性为TRUE的RadioButton开始直到碰到下一个选上Group属性的RadioButton的前一个RadioButton为一个组。

奔波尔灞 3731

实现checkbox(多项选择)和radio button(单项选择)功能

超强TreeView,实现checkbox(多项选择)和radio button(单项选择)功能

常用控件Radio Button的常用用法

常用控件Radio Button的常用用法 Posted on 2005-08-27 11:15 zuilang 阅读(385) 评论(4)  编辑 收藏 <!--<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:dc="http://purl.org/dc/elements/1.1/"xmlns

1704

MFC中Radio Button的用法详解

本文通过针对两个常见问题的解决方案,详细阐述了MFC中Radio Button的用法。有助于读者加深对于MFC运行机制及Radio Button控件用法的理解。 首先为对话框加上2个radio button,分别是Radio1和Radio2。 问题1:如何让Radio1或者Radio2默认选上?如何知道哪个被选上了? 关键是选上,“默认”只要放在OnInitDialog()即可。有如下的三种方法可以让它选上: 第一种: ((CButton *)GetDlgItem(IDC_RADIO1))->SetCheck(TRUE);//选上 ((CButton *)GetDlgItem(IDC_RAD

避坑指南:汇川SV660N配合SOEM时,PDO映射与CiA402状态机那些容易出错的地方

本文深入解析汇川SV660N伺服驱动与SOEM主站在PDO动态映射和CiA402状态机切换中的常见问题,提供实战代码和调试技巧。重点解决PDO配置时序、状态机转换同步等关键难点,帮助工程师避免典型错误,实现稳定通信与控制。

weixin_30653023的博客 498

VC RadioBox控件用法(转)

先为对话框加上2个radio button,分别是Radio1和Radio2。 <br />问题1:如何让Radio1或者Radio2默认选上?如何知道哪个被选上了?<br /><br />关键是选上,“默认”只要放在OnInitDialog()即可。三种方法可以让它选上,<br />第一种:<br />((CButton *)GetDlgItem(IDC_RADIO1))->SetCheck(TRUE);//选上<br />((CButton *)GetDlgItem(IDC_RADIO1))->Set

lwprain的专栏 1602

手把手教你用Docker快速部署ZLMediaKit流媒体服务器(含WebRTC配置)

本文详细介绍了如何使用Docker快速部署ZLMediaKit流媒体服务器,并配置WebRTC功能。通过容器化部署,实现环境一致性、资源隔离和快速扩展,同时提供WebRTC专项配置、多协议推拉流实战测试及生产环境优化建议,帮助开发者高效搭建企业级流媒体平台。

agile9scrum的博客 202

[VC6] RadioBox使用入门

基于对话框的应用程序,界面如下: 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 具体请参考代码: 关键代码: // del2Dlg.cpp : implementation file // #include "stdafx.h" #include "del2.h" #include "del2Dlg.h" #ifde

JoeBlackZQQ的专栏 2387

Win10下ISE14.7安装避坑全记录:从License加载失败到ChipScope连不上,我踩过的雷都在这了

本文详细记录了在Win10系统下安装ISE14.7时遇到的常见问题及解决方案,包括License加载失败、IMPACT闪退、ChipScope连接故障等。通过实际案例和步骤解析,帮助用户避开安装陷阱,确保FPGA开发工具顺利运行。特别针对license问题提供了兼容性设置和文件修改的实用技巧。

weixin_42683394的博客 225

别再手动跑定时任务了!Spring Boot项目5分钟集成xxl-job保姆级教程(含Docker部署调度中心)

本文提供Spring Boot项目快速集成xxl-job的保姆级教程,包括Docker部署调度中心的详细步骤。通过实战案例展示如何构建企业级分布式任务调度系统,解决传统定时任务的资源竞争、单点故障等问题,提升开发效率与系统可靠性。

weixin_30315905的博客 291

VC6.0常用控件使用方法

VC6.0常用控件使用方法   2011-02-18 23:39:02|  分类: MFC / C++ |  标签: |字号大中小 订阅 *除非特别说明,本文中所用控件变量类型为Control 一般控件可用/不可用 EnableWindow(TRUE); EnableWindow(FALSE); 1、Static Text------------静态控件

msbbc的专栏 1445

Verilog语法之十:过程块(initial和always)

我将Verilog的语法进行了总结,写了13篇文章,让小白“快速见识猪如何跑”,每一篇讲解一类语法,结合正确的示例代码和错误的示例代码,有的章节对个别语法进行了归纳总结,帮助初学者加深理解。

航天领域资深码农,型号经验丰富,一线干货分享 1672

开源一个简单的VC界面库

转摘惯了,一时要主动码字,竟发现无从下笔。简单的说,就是我把工作中一些常用的控件,整理成一个简单的VC界面库。界面库命名为:TzUI,支持控件包括:Static、Button、Edit、Slider、Progress、ComboBox、RadioBox、CheckBox。源码托管在csdn上,地址为:https://download.youkuaiyun.com/download/zwz1984...

白月光的专栏 3673

SPV1050低功耗微功率太阳能充电管理模块原理图设计,已量产

在物联网应用快速普及的今天,户外低功耗传感器(如土壤温湿度、环境光照、无线节点等)的供电始终是行业痛点 —— 传统锂电池不仅需要定期更换,维护成本高,还难以满足 “终身免维护” 的场景需求。为此,我们设计了一款专为 1V~3V 低电压小型太阳能板优化的微功率太阳能电源管理模块,结合 USB 备用充电路径,实现了低功耗传感器的长期自主供电。

不脱发的程序猿 444

AUTOSAR进阶图解==>AUTOSAR_SWS_BSWGeneral

本文详细解析AUTOSAR基础软件(BSW)模块的通用规范,涵盖其分层架构、配置管理、初始化流程和状态转换机制。AUTOSAR采用清晰的分层设计,包括应用层、服务层、ECU抽象层和微控制器抽象层,各层模块通过标准化接口交互。BSW模块配置采用类型化定义,支持预初始化、初始化和后期构建配置。文档还阐述了模块初始化流程中的依赖管理,以及运行时的状态转换与错误处理机制,为汽车电子控制单元的标准化开发提供规范指导。

一名留德华的,康德的信徒的,专注于汽车电子领域的博客 1127

VC SDK使用

 记录下debug 出现的问题,很菜啊vc用的。。。 1. radio box crash 使用死机的问题,代码上看已经按要求写的,DDX_Radio交换数据,可是一运行就出现警告窗口。本意是选RED,m_nradio=0,BLUE ,M_NRADIO=1,GREEN,M_NRADIO=2,书上也是这么写的,然后 通过DDX_Radio(pDX,IDC_RED,m_nradio)实

autumn32的专栏 656

基于Simulink的智能车辆电子稳定控制(ESC)仿真

本文完成了基于 Simulink 的智能车辆电子稳定控制(ESC),实现了:✅ 构建含轮胎非线性的车辆动力学模型✅ 设计滑模横摆稳定性控制器✅ 实现四轮制动力分配逻辑✅ 验证在双移线低附着场景下的卓越稳定性✅ 为主动安全控制系统开发提供完整范式。

xiaoheshang_123的博客 79

CLKing31-------------VC6.0常用控件常用方法介绍

VC6.0常用控件常用方法介绍 mubai007 2009-03-12 19:59:00 4754 收藏 2 分类专栏: VC6.0 文章标签: integer report button string list attributes 版权 *除非特别说明,本文中所用控件变量类型为Control 一般控件可用/不可用 EnableWindow(TRUE); EnableWindow(FALSE); 1、Static Text------------静态控件 --类CStatic 取值/...

zhangdaqian789的博客 403

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

深度学习工具包 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")

VC雕虫小技集(七)

  VC雕虫小技集(七)何志丹1,图片控件右键属性 type : bitmap你直接选image也行IDB_BITMAP1位图的IDm_ctrl 是与图片控件相关联的控制型变量void CDlg2Dlg::OnButton1() {       CBitmap bitmap1;       bitmap1.LoadBitmap(IDB_BITMAP1);

闻缺陷则喜何志丹 3599

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

VC实现对话框的透明

<br />正在进行中

kay_1010的专栏 639

VC 6.0常用控件使用方法介绍

除非特别说明,本文中所用控件变量类型为Control 一般控件可用/不可用 EnableWindow(TRUE); EnableWindow(FALSE); 1、Static Text------------静态控件 --类CStatic  取值/赋值(变量类型为Control) m_lbl.GetWindowText(string); m_lbl.SetWindowText(s

oceanark的博客 1711

VC中Radio控件的用法

http://blog.chinaunix.net/u2/65112/showart_515771.html     String rootPath = Server.MapPath("~");         if (FileUpload1.HasFile)        {            FileUpload1.SaveAs(rootPath+"\\" + FileUpload1.Fi...

中原一点红博客 218

建筑平面图, 建筑设计图, 家具摆放图, 制作, 开发, 软件, VC++, 源代码组件库

使用E-Form++可视化图形组件库开发类似于Visio的建筑平面图、布局图等软件系统非常容易,矢量图编辑应用是从E-Form++诞生之日起就一直处于非常重要的地位,我们将其作为E-Form++可视化图形组件库的头号解决方案来展开设计。很高兴的是,现在已经大功告成,您会发现,E-Form++此部分功能已经能够与当今世界最专业的图形编辑程序媲美,例如:Visio, ConceptDraw, SmartDraw等等,除此之外E-Form++还有一点是他们绝对做不到的:将所有经过严格测试的VC++源代码提供给客户

jackonlyone的专栏 2135

组织结构图, 上下关系, 层次关系, 打印, 设计, 编辑, VC++, 示例, 源代码

组织结构图, 上下关系, 层次关系, 打印, 设计, 编辑, VC++, 示例, 源代码 --企业级流程图、关系图、子图,源码全开放VC++解决方案!   E-Form++为开发任何基于组织图的应用程序提供了全套解决方案,

jackonlyone的专栏 1714
上一篇: word小技巧_修改时,出现注释
下一篇: C中文件包含的一些认识
lbjfeng
博客等级 码龄19年 38粉丝 31原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值