VC控件--CListCtrl使用技巧(二)

CListCtrl控件属性自定义与实战 CListCtrl是MFC(Microsoft Foundation Classes)框架中用于显示和管理列表数据的重要控件,广泛应用于Windows桌面应用程序开发。它支持多种显示模式,包括图标视图(LV_VIEW_ICON)、小图标视图(LV_VIEW_SMALLICON)、列表视图(LV_VIEW_LIST)和报表视图(LV_VIEW_DETAILS),其中报表视图最为常用,适用于展示结构化数据。在MFC中,CListCtrl通常用于对话框或视图中,通过资源编辑器添加控件或动态创建方式实现。 阅读详情

20. listctrl的subitem添加图标

      m_list.SetExtendedStyle(LVS_EX_SUBITEMIMAGES);
      m_list.SetItem(..); //
具体参数请参考msdn

 


21. 在CListCtrl显示文件,并根据文件类型来显示图标

      网上找到的代码,share
      BOOL CTest6Dlg::OnInitDialog()
      {
           CDialog::OnInitDialog();
  
           HIMAGELIST himlSmall;
           HIMAGELIST himlLarge;
           SHFILEINFO sfi;
           char  cSysDir[MAX_PATH];
           CString  strBuf;
 
           memset(cSysDir, 0, MAX_PATH);
  
           GetWindowsDirectory(cSysDir, MAX_PATH);
           strBuf = cSysDir;
           sprintf(cSysDir, "%s", strBuf.Left(strBuf.Find("
//")+1));
 
           himlSmall = (HIMAGELIST)SHGetFileInfo ((LPCSTR)cSysDir, 
                      0, 
                      &sfi,
                      sizeof(SHFILEINFO), 
                      SHGFI_SYSICONINDEX | SHGFI_SMALLICON );
  
           himlLarge = (HIMAGELIST)SHGetFileInfo((LPCSTR)cSysDir, 
                      0, 
                      &sfi, 
                      sizeof(SHFILEINFO), 
                      SHGFI_SYSICONINDEX | SHGFI_LARGEICON);
  
           if (himlSmall && himlLarge)
           {
                ::SendMessage(m_list.m_hWnd, LVM_SETIMAGELIST,
                             (WPARAM)LVSIL_SMALL, (LPARAM)himlSmall);
                ::SendMessage(m_list.m_hWnd, LVM_SETIMAGELIST,
                             (WPARAM)LVSIL_NORMAL, (LPARAM)himlLarge);
           }
           return TRUE;  // return TRUE  unless you set the focus to a control
      }
 
      void CTest6Dlg::AddFiles(LPCTSTR lpszFileName, BOOL bAddToDocument)
      {
           int nIcon = GetIconIndex(lpszFileName, FALSE, FALSE);
           CString strSize;
           CFileFind filefind;
 
           //  get file size
           if (filefind.FindFile(lpszFileName))
           {
                filefind.FindNextFile();
                strSize.Format("%d", filefind.GetLength());
           }
           else
                strSize = "0";
  
           // split path and filename
           CString strFileName = lpszFileName;
           CString strPath;
 
           int nPos = strFileName.ReverseFind('//');
           if (nPos != -1)
           {
                strPath = strFileName.Left(nPos);
                strFileName = strFileName.Mid(nPos + 1);
           }
  
           // insert to list
           int nItem = m_list.GetItemCount();
           m_list.InsertItem(nItem, strFileName, nIcon);
           m_list.SetItemText(nItem, 1, strSize);
           m_list.SetItemText(nItem, 2, strFileName.Right(3));
           m_list.SetItemText(nItem, 3, strPath);
      }
 
      int CTest6Dlg::GetIconIndex(LPCTSTR lpszPath, BOOL bIsDir, BOOL bSelected)
      {
           SHFILEINFO sfi;
           memset(&sfi, 0, sizeof(sfi));
  
           if (bIsDir)
           {
            SHGetFileInfo(lpszPath, 
                         FILE_ATTRIBUTE_DIRECTORY, 
                         &sfi, 
                         sizeof(sfi), 
                         SHGFI_SMALLICON | SHGFI_SYSICONINDEX |
                         SHGFI_USEFILEATTRIBUTES |(bSelected ? SHGFI_OPENICON : 0)); 
            return  sfi.iIcon;
           }
           else
           {
            SHGetFileInfo (lpszPath, 
                         FILE_ATTRIBUTE_NORMAL, 
                         &sfi, 
                         sizeof(sfi), 
                         SHGFI_SMALLICON | SHGFI_SYSICONINDEX | 
                         SHGFI_USEFILEATTRIBUTES | (bSelected ? SHGFI_OPENICON : 0));
            return   sfi.iIcon;
           }
           return  -1;
      }

 


22. listctrl内容进行大数据量更新时,避免闪烁

      m_list.SetRedraw(FALSE);
      //
更新内容

      m_list.SetRedraw(TRUE);
      m_list.Invalidate();
      m_list.UpdateWindow();
 
或者参考

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cwnd.3a3a.setredraw.asp

 


23. listctrl排序

Q250614:How To Sort Items in a CListCtrl in Report View
http://support.microsoft.com/kb/250614/en-us

 


24. 在listctrl中选中某个item时动态改变其icon或bitmap

Q141834: How to change the icon or the bitmap of a CListCtrl item in Visual C++
http://support.microsoft.com/kb/141834/en-us


25. 在添加item后,再InsertColumn()后导致整列数据移动的问题

Q151897: CListCtrl::InsertColumn() Causes Column Data to Shift
http://support.microsoft.com/kb/151897/en-us

 


26. 关于listctrl第一列始终居左的问题

解决办法:把第一列当一个虚列,从第二列开始插入列及数据,最后删除第一列。
     
具体解释参阅   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/listview/structures/lvcolumn.asp

 


27. 锁定column header的拖动

http://msdn.microsoft.com/msdnmag/issues/03/06/CQA/

 


28. 如何隐藏clistctrl的列

    把需隐藏的列的宽度设为0,然后检测当该列为隐藏列时,用上面第27点的锁定column 的拖动来实现


29. listctrl进行大数据量操作时,使用virtual list   

http://www.codeguru.com/cpp/controls/listview/advanced/article.php/c4151/
http://www.codeproject.com/listctrl/virtuallist.asp

 


30. 关于item只能显示259个字符的问题

解决办法:需要在item上放一个edit。

 


31. 响应在listctrl的column header上的鼠标右键单击

Q125694: How To Find Out Which Listview Column Was Right-Clicked
http://support.microsoft.com/kb/125694/en-us

 


32. 类似于windows资源管理器的listview

Q234310: How to implement a ListView control that is similar to Windows Explorer by using DirLV.exe
http://support.microsoft.com/kb/234310/en-us

 


33. 在ListCtrl中OnTimer只响应两次的问题

Q200054:
PRB: OnTimer() Is Not Called Repeatedly for a List Control
http://support.microsoft.com/kb/200054/en-us


34. 以下为一些为实现各种自定义功能的listctrl派生类

          (1)    拖放       
                  
http://www.codeproject.com/listctrl/dragtest.asp

                   在CListCtrl和CTreeCtrl间拖放
                   http://support.microsoft.com/kb/148738/en-us
 
          (2)   
多功能listctrl
                  
支持subitem可编辑,图标,radiobutton,checkbox,字符串改变颜色的类
                   http://www.codeproject.com/listctrl/quicklist.asp
 
                  
支持排序,subitem可编辑,subitem图标,subitem改变颜色的类
                   http://www.codeproject.com/listctrl/ReportControl.asp

          (3)    subitem中显示超链接
                   http://www.codeproject.com/listctrl/CListCtrlLink.asp

          (4)    subitem的tooltip提示
                   http://www.codeproject.com/listctrl/ctooltiplistctrl.asp

          (5)    subitem中显示进度条   
                  
http://www.codeproject.com/listctrl/ProgressListControl.asp
                   http://www.codeproject.com/listctrl/napster.asp
                   http://www.codeguru.com/Cpp/controls/listview/article.php/c4187/

          (6)    动态改变subitem的颜色和背景色
                    http://www.codeproject.com/listctrl/highlightlistctrl.asp
                    http://www.codeguru.com/Cpp/controls/listbox/colorlistboxes/article.php/c4757/
 
          (7)   
类vb属性对话框
                    http://www.codeproject.com/listctrl/propertylistctrl.asp
                    http://www.codeguru.com/Cpp/controls/listview/propertylists/article.php/c995/
                   
http://www.codeguru.com/Cpp/controls/listview/propertylists/article.php/c1041/
 
          (8)   
选中subitem(只高亮选中的item)
                    http://www.codeproject.com/listctrl/SubItemSel.asp
                    http://www.codeproject.com/listctrl/ListSubItSel.asp
 
          (9)   
改变行高
                    http://www.codeproject.com/listctrl/changerowheight.asp
 
          (10)  
改变行颜色
                    http://www.codeproject.com/listctrl/coloredlistctrl.asp
 
          (11)  
可编辑subitem的listctrl
                    http://www.codeproject.com/listctrl/nirs2000.asp
                    http://www.codeproject.com/listctrl/editing_subitems_in_listcontrol.asp
 
          (12)   subitem
可编辑,插入combobox,改变行颜色,subitem的tooltip提示
                    http://www.codeproject.com/listctrl/reusablelistcontrol.asp
 
          (13)   header
中允许多行字符串
                    http://www.codeproject.com/listctrl/headerctrlex.asp
 
          (14)  
插入combobox
                    http://www.codeguru.com/Cpp/controls/listview/editingitemsandsubitem/article.php/c979/
 
          (15)  
添加背景图片
                    http://www.codeguru.com/Cpp/controls/listview/backgroundcolorandimage/article.php/c4173/
                    http://www.codeguru.com/Cpp/controls/listview/backgroundcolorandimage/article.php/c983/
                    http://www.vchelp.net/vchelp/archive.asp?type_id=9&class_id=1&cata_id=1&article_id=1088&search_term=
   
          (16) 
自适应宽度的listctrl
                    http://www.codeproject.com/useritems/AutosizeListCtrl.asp

          (17)  改变ListCtrl高亮时的颜色(默认为蓝色)
                  
处理 NM_CUSTOMDRAW
           http://www.codeproject.com/listctrl/lvcustomdraw.asp

 
STM32cubeMX配置FreeRTOS软件定时器 文章目录前言1.软件定时器概述一.软件定时器特性二、使用cubeMX生成软件定时器总结 前言 本文主要带大家了解什么是软件定时器,并且带大家使用cubeMX配置软件定时器。 1.软件定时器概述 一.软件定时器特性 软件定时器就是一个闹钟当时间到了就执行相对应的任务或者代码。软件定时器是基于系统滴答中断的。在FreeRTOS中我们可以设置无数个软件定时器。 指定时间:启动定时器和运行回调函数,两者的间隔被称为定时器的周期 (period)。 指定类型定时器有两种类型: 1.一次性 这类定时器启动后,它的回调函 阅读详情

相关推荐

CCF CSP历年题解(python)

菜鸡一枚,没参加过算法竞赛,单纯为了抵研究生考试复试才刷题,通过写博客记录下来,希望能和大家互相交流,代码质量不高,大家见谅。 因为考研等原因,题目不定期更新… 第一题 201312-1出现最多次数的数 ...

weixin_44690402的博客 5011

C++--CListCtrl使用技巧的摘抄

1. CListCtrl 风格      LVS_ICON: 为每个item显示大图标      LVS_SMALLICON: 为每个item显示小图标      LVS_LIST: 显示一列带有小图标的item      LVS_REPORT: 显示item详细资料      直观的理解:windows资源管理器,“查看”标签下的“大图标,小图标,列表,详细资料”2. 设置listctr

SAP BLOG--Jack Wu 4970

从Applied Intelligence被拒到The Visual Computer录用:我的计算机视觉论文投稿时间线全记录(含详细修改意见)

本文详细记录了作者从Applied Intelligence被拒到The Visual Computer成功发表计算机视觉论文的全过程,重点分享了如何将模糊的拒稿理由转化为具体改进方案。文章包含技术改进细节、写作调整策略以及期刊选择经验,为计算机视觉领域的研究者提供了实用的投稿指南。

weixin_30872499的博客 474

vc CListCtr控件设置指定行字体颜色,背景颜色

一开始以为CListBox和CListCtr是差不多的,用CListBox手动添加NM_CUSTOMDRAW消息后,一直不响应,不知道是什么原因,只能改用CListCtr,CListCtr可以通过类向导添加NM_CUSTOMDRAW,就比较方便了. 先定义一个宏#define LRED 1 绑定CListCtr控件变量m_list 通过类向导添加NM_CUSTOMDRAW后,在消息映射函数中...

boke的博客 1195

免费AI视频生成全流程:通义千问+Seedance 2.5+Grok实战指南

AI视频生成正在成为内容创作的重要方式,但高昂的API费用常让个人创作者望而却步。实际上,通过合理组合云端免费工具,也能搭建一条完整的视频生产链路:利用大模型生成脚本,用视频生成模型将文本渲染成画面,再借助多模态模型进行一致性校验。这种“文本+视频+多模态”的协作模式,将复杂的生成任务解耦为可独立调用的模块,既降低了本地硬件要求,也为批量内容验证提供了低成本方案。该流程适用于短视频素材快速产出、产品Demo验证以及AI应用集成等场景,核心在于打通免费账号、API调用与批量任务调度。本文以通义千问、Seeda

weixin_29044157的博客 398

低成本实现webhook接收端[python]

Webook本质上也是API,只不过是反向调用,即前端不主动发送请求,完全由后端推送。简单来说,Webhook是一个接受HTTP POST或是GET,PUT,DELETE的URL,一个实现了Webhook的API提供商就是在当事件发生的时候会向配置的URL发送信息,与请求-响应式不同,使用Webhook可以实时接收到变化。Ps:Webhook可能会发出大量的请求,确保接受的URL不被泄露或者应用能及时处理这些请求。

锡城小凯的博客 1万+

CListCtrl使用技巧

CListCtrl使用技巧 以下未经说明,listctrl默认view 风格为report 1. CListCtrl 风格       LVS_ICON: 为每个item显示大图标       LVS_SMALLICON: 为每个item显示小图标       LVS_LIST: 显示一列带有小图标的item       LVS_REPORT: 显示item详细资料

狂奔之林的博客 1078

基于反事实的因果推理Causal inference based on counterfactuals--一万六千字文献详细解读(因果关系的推理应用)【全文总结】

基于反事实的因果推理Causal inference based on counterfactuals--一万六千字文献详细解读(因果关系的推理应用)【全文总结】---来自一位即将入学的准研一,也希望这篇文章能够激励自己不断走下去!!

qq_46044325的博客 4448

VC中CListCtrl用法详解

1. CListCtrl 风格<br />      LVS_ICON: 为每个item显示大图标<br />      LVS_SMALLICON: 为每个item显示小图标<br />      LVS_LIST: 显示一列带有小图标的item<br />      LVS_REPORT: 显示item详细资料<br />      直观的理解:windows资源管理器,“查看”标签下的“大图标,小图标,列表,详细资料”<br /> 2. 设置listctrl 风格及扩展风格<br />      LO

dlfer11的专栏 798

无线传感网络的Matlab实现

Matlab是一种功能强大的数值计算和数据分析工具,也可以用于无线传感网络的建模和仿真。根据实际需求,可以进一步扩展和优化模型,例如考虑节点能量消耗、网络路由、数据融合等方面的问题。函数用于绘制节点之间的连接关系,其中第一个参数是邻接矩阵,描述了节点之间的连接关系。这里使用了一个4个节点的简单例子,可以根据实际需求修改节点数量和连接关系。可以使用Matlab中的图形绘制函数来可视化节点的位置和连接关系。在无线传感网络中,节点的能量是一个关键因素。通过计算节点的剩余能量,可以评估节点的能量消耗情况。

2301_79331387的博客 251

YOLOv11 损失函数进阶:SlideLoss 让小目标检测精度飙升

创建self.loss_fun = loss_fun # 基础损失函数(如BCEWithLogitsLoss)self.loss_coef = loss_coef # 损失系数# 计算滑动权重:根据预测与真实值的差异判断样本难度# 难度越高,权重越大该类在原有损失函数的基础上,通过diff计算样本预测与真实值的差异(差异越大,样本越难),进而生成动态权重,实现对难样本的重点学习。

m0_64661770的博客 239

VC的CListCtrl控件

1. CListCtrl 样式及设置2. 扩展样式设置3. 数据插入4. 一直选中Item5. 选中和取消选中Item6. 得到CListCtrl中所有行的checkbox的状态7. 得到CListCtrl中所有选中行的序号8. 得到item的信息9. 得到CListCtrl的所有列的header字符串内容10. 使CListCtrl中一项可见,即滚动滚动条

sghgcn的专栏 3万+

【100%通过率】2023华为od机试C卷【电脑病毒感染】C语言 实现

一个局域网内有很多台电脑,分别标注为 0 ~ N-1 的数字。相连接的电脑距离不一样,所以感染时间不一样,感染时间用t 表示。其中网络内一台电脑被病毒感染,求其感染网络内所有的电脑最少需要多长时间。如果最后有电脑不会感染,则返回-1.

MISAYAONE的博客 1047

VC ------CListCtrl使用技巧

VC ------CListCtrl使用技巧 ( Thu, 12 Feb 2009 09:22:46 +0800 ) Description:LVS_ICON: 为每个item显示大图标      LVS_SMALLICON: 为每个item显示小图标      LVS_LIST: 显示一列带有小图标的item  

skyremember的专栏 3276

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

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

【转帖】VC中使CListCTrl控件排序

 http://blog.sina.com.cn/s/blog_5baa65b30100ahxm.htmlVC中使CListCTrl控件排序(2008-09-26 18:41:19)标签:杂谈   分类:软件开发   列表控件(CListCtrl)的排序功能不像其它直接调用API就可以完成的功能一样.它比较复杂.今天将我的一点体会简单地谈一下. 列表控件的顶部有一排按钮,用户可以通过选

qpx0033的专栏 819

InTheHand.Net.Personal+BlueTooth4,蓝牙开发

项目中有蓝牙开发的必备dll,现在网上相关的文档博客不少,有的说的多有的说少,但是却很少有这两个dll,分享一下。

VC中CListCtrl排序

<br /> <br />VC中CListCtrl排序<br /> <br />编号:A3GS_TV20100113001<br /> <br />描述:<br /> <br />本文以实例代码的形式讲述了在VC中实现CListCtrl的排序。<br /> <br />例子:<br /> <br />请下载文本例子代码<br /> <br />技术实现:<br /> <br />一、声明一个用于排序用的结构体,如下:<br />    typedefstruct tag_ListSortNode<br />

小辣椒 2379

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

VC CListCtrl控件的使用方法

在VC中使用控件一直是件让我头痛的事件,从控件的创建到控件的操作管理,都得写一大堆代码,相比于Delphi/VB,实在是麻烦多了。其实在之前学习SDK的时候,就有想过专门花点儿时间来学习VC中控件的使用,但一直没空。最近准备写一个小工具,要用到ListCtrl控件,所以又不得不好好的恶补一翻。我是在MFC的对话框模式下使用CListCtrl控件的,其实不管在SDK或文档/视图模式下,VC控件的使用

冷寒生读书笔记 7461

VC中CListCtrl使用技巧

使用C++开发的人基本上对MFC都是比较熟悉的了,说实在的本文并没有什么新鲜的东西,本文只是在开发《小悦2013》时很多地方用到ClistCtrl,所以在此就把MFC中的ClistCtrl使用总结一下,以供大家参考。   1.      CListCtrl 风格 LVS_ICON: 为每个item显示大图标     LVS_SMALLICON: 为每个item显示小图标    

小悦2013 994

vc CListCtrl 使用技巧1

 1. CListCtrl 风格      LVS_ICON: 为每个item显示大图标       LVS_SMALLICON: 为每个item显示小图标       LVS_LIST: 显示一列带有小图标的item       LVS_REPORT: 显示item详细资料       直观的理解:windows资源管理器,“查看”标签下的“大图标,小图标,列表,详细资料” 2. 设置listc

halibobo520的专栏 673

CListCtrl控件

CListCtrl控件 (2007-04-14 11:50:38)   分类:VC++常用控件操作通过这片播客,你可以获得一下信息:1. CListCtrl 样式及设置2. 扩展样式设置3. 数据插入4. 一直选中Item5. 选中和取消选中Item6. 得到CListCtrl中所有行的checkbox的状

海边的猪 1701

VC之列表控件背景色设置

本文简单介绍下VC程序中list列表控件的背景设置。 1.新建对话框应用程序 首先,新建对话框应用程序,然后添加两个list列表控件 2.设置控件模式为报告模式 3.添加控件变量 CMyListCtrl2 m_list2; CMyListCtrl m_list1; 4.设置列表属性 void CListBackgroundDlg::S

冰点蓝欣的专栏 4562
上一篇: VC控件--CListCtrl使用技巧(一)
下一篇: 去掉对话框在任务栏中的显示框
primer_programer
博客等级 码龄20年 283粉丝 180原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址