In my VC MFC develop expericence, I always find that it is really poor of the Ctrls that microsoft provided, but we have no much project budget to bug a beautiful third-ctrl. So sometimes we need do some work to modify the standard Control. For the purpose of reuse, I have my library database, though lots of them come from internet, and I just did little work. but I still very pleasure to share with your guys.
Click here to download.
At first, I want introduce XListCtrl to you.
This control was developed by
Hans Dietrich , you can
click here to view his web page. You can find this beautiful and powerful feature list, before that, let's have a look this beautiful picture:
- First column is specified with checkboxes
- The second column shows subitem with bold text
- The second column shows subitem with different background color
- The third column contains progress bar in row 2
- The fourth column also contains checkboxes
- The fifth column shows subitem with different background color
- The sixth column shows subitem with different text and background colors
- The second column shows combobox
- The sixth row is disabled
- The fifth column shows edit control
What I do?
At first, Let me show picture.
Keep all features from hans' xlistctrl.
1, Modify the edit feature, add OK, Cancel button, It will be more friendly to user.
2, Add change the font's style: italic
How to Use:
<!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
-->CRect rect;
xlist.GetWindowRect(&rect);
int w = rect.Width() - 2;
int colwidths[6] = { 3, 26, 8, 19, 6, 15 }; // sixty-fourths
int cols = 0;
TCHAR * lpszHeaders[] = { _T(""),
_T("File Name"),
_T("Speed(kb/s)"),
_T("Progress"),
_T("Time Left"),
NULL };
int i;
int total_cx = 0;
LV_COLUMN lvcolumn;
memset(&lvcolumn, 0, sizeof(lvcolumn));
// add columns
for (i = 0; ; i++)
{
if (lpszHeaders[i] == NULL)
break;
lvcolumn.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
lvcolumn.fmt = (i == 1 || i == 5) ? LVCFMT_LEFT : LVCFMT_CENTER;
lvcolumn.pszText = lpszHeaders[i];
lvcolumn.iSubItem = i;
lvcolumn.cx = (lpszHeaders[i+1] == NULL) ? w - total_cx - 2 : (w * colwidths[i]) / 64;
total_cx += lvcolumn.cx;
xlist.InsertColumn(i, &lvcolumn);
}
cols = i; //total columns
// iterate through header items and attach the image list
HDITEM hditem;
for (i = 0; i < xlist.m_HeaderCtrl.GetItemCount(); i++)
{
hditem.mask = HDI_IMAGE | HDI_FORMAT;
xlist.m_HeaderCtrl.GetItem(i, &hditem);
hditem.fmt |= HDF_IMAGE;
if (i == 0)
{
hditem.iImage = XHEADERCTRL_UNCHECKED_IMAGE;
hditem.fmt = HDF_CENTER;
}
else
hditem.iImage = XHEADERCTRL_NO_IMAGE;
xlist.m_HeaderCtrl.SetItem(i, &hditem);
}
// add edit button picture
HBITMAP hBitmapOK = LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_EDIT_BTNOK));
HBITMAP hBitmapCancel = LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_EDIT_BTNCANCEL));
m_xlist.SetEditBtnIcon(hBitmapOK, hBitmapCancel);
<!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--> LVITEM itemData;
itemData.iSubItem = 0;
itemData.iItem = 0;
itemData.mask = LVIF_TEXT;
itemData.pszText = _T("");
itemData.lParam = (LPARAM)pJob;
CString szTmp;
nItem = m_xlist.InsertItem(&itemData);
m_xlist.SetCheckbox( nItem, 0, FALSE );
m_xlist.SetItemText( nItem, 1, pJob->m_szNewDocName.GetLength() == 0 ? pJob->m_szFileName : pJob->m_szNewDocName); //doc name
m_xlist.SetEditButton( nItem, 1);
m_xlist.SetItemText( nItem, 3, _T("")); //progress bar
pJob->GetLeftTimeString(szTmp);
m_xlist.SetItemText( nItem, 4, szTmp ); //time left estimate
szTmp.Format( "%.2lf", pJob->CountSpeed()/1024 );
m_xlist.SetItemText( nItem, 2, szTmp ); //transfer speed average
ON_REGISTERED_MESSAGE(WM_XLISTCTRL_EDIT_BTNOK_CLICKED, OnRenameClicked)
ON_REGISTERED_MESSAGE(WM_XLISTCTRL_EDIT_BTNEDIT_CLICKED, OnRenameEditClicked)
ON_REGISTERED_MESSAGE(WM_XLISTCTRL_HEADER_CHECKBOX_CLICKED, OnHeaderChecked)
Implement these message function.
That' OK.
分享到:
相关推荐
askbot-devel:Askbot是DjangoPython问答论坛。 **贡献者自述文件**:https:github.comASKBOTaskbot-devel#how-to-contribute。 可在https:askbot.com上获得Askbot的商业托管和支持
tribut.jquery.org 所有jQuery项目共有的开发人员文档建造要构建和部署更改以在实例中进行预览,请遵循我们的文档中对的。
Hacktoberfest_19 您可以在其中以您选择的任何语言上载任何代码的存储库。 随意在这里添加您的代码:) 贡献步骤 分叉存储库 使用终端或gitbash克隆您的分叉存储库。 git clone <link-of-repos>...
前端开源库-contribute贡献,贡献用户行为到谷歌分析账户-与代理一起工作
cmake opencv3.4.5时不容易下载得几个模块文件和单独提取出的一份c++工程用的opencv3.4.5依赖头文件和lib、dll库,可以直接在vs中使用
contribute list: 开源贡献 / 个人项目 使用工具github-contribution制作() 开源项目贡献统计(55 merged) 个人项目 : 基于搜狗微信搜索的微信公众号爬虫接口 : 南航青协小程序 : go语言redis客户端 : 展示在leetcode...
rate, contribute to congestion. Additionally, we consider the joint control of the EDCA and HCCA mechanisms, which allows us to determine the optimal sharing of the wireless channel between the two ...
OpenCV3.4.1(MSVC2015 x64)+cuda9.1+contribute3.4.1,亲测可用
Macromedia出品的全新概念网页设计工具,可以将网页编写程序化繁为简, 制作网页, 现在就如使用文字处理一样, 一般企业用户无需学习高深技术亦可实时上手, 而网页专家制作及管理网站时就更如虎添翼。
OpenCV 3.4.0 加入 contribute 模块后 Cmake 编译结果
opencv_contribute-4.2.0的压缩包,官网上下载速度超级慢,建议大家从CSDN上下载,这里速度很快
win10 X64和VS2017的环境下编译的OpenCV-3.1.0 contribute库文件
如果您想将您正在使用的地址提交给 OpenAddresses 项目,请设置contribute=true如下所示: curl --data "address=10 Downing Street, London, SW1A 2AA&contribute=true" http://sorting-office.openaddressesuk.
A fully Material ToDo app with minimal features, just enough to be useful. Screenshots: Download App Icon Designed by Christopher Gundersen Translations Spanish by nanopc German by ...
在windows上利用MinGW编译器编译的OpenCV 3.4版本的release版本,包含Contribute部分
openobject-contribute 电子书,学习手册
vs2019环境下重新编译opencv4.5.1,包含了扩展库opencv_contribute4.5.1以及cuda,文件内容包含opencv4.5.1和opencv_contribute4.5.1的源码,以及编译过程中需要下的ffmpeg等文件
你好,福克斯,我是JoHn MuRiU :waving_hand: 前锋开发人员 console.log('Forever Explorer'); 我是来自肯尼亚的热情的前端Web开发人员。 谈论个人资料: ... log ( `Feel free to contribute` ) ; 支持:
Contribute buddy将为您解决此问题,并确保每个人都已阅读该文档,并且每个人都将被告知有关文档中的更新的信息。 安装 $ npm install contribute-buddy 用法 $ contribute-buddy init Init会将package ...
- <lom:contribute> - <lom:role> <lom:source uniqueElementName="source">OCW_LOMv1.0</lom:source> <lom:value uniqueElementName="value">Author</lom:value> </lom:role> <lom:entity>Rogers, Hartley...