<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0057)http://go1.163.com/~81000/source/adv_ui/gfxlist.shtml.htm -->
<HTML><HEAD><TITLE>mfc programmer's sourcebook : advanced ui</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=content-type>
<META content="zafir anjum" name=author>
<META content="source code for implementing advanced ui features"
name=description>
<META content="" name=keywords>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>
<BODY background=gfxlist.shtml.files/di2001.jpg bgColor=#ffffff
tppabs="http://www.codeguru.com/fancyhome/back.gif">
<H3 align=center><FONT color=#a0a099>list control - enhanced list
control</FONT></H3>
<HR align=center>
<P>this article was contributed by <A href="mailto:warch@tin.it">iuri
apollonio</A>. </P>
<P><A href="http://go1.163.com/~81000/source/adv_ui/gfxlist.zip"
tppabs="http://www.codeguru.com/advancedui/gfxlist.zip">download demo with
formview and dialog </A>534k </P>
<P><A href="http://go1.163.com/~81000/source/adv_ui/gfxdaolist.zip"
tppabs="http://www.codeguru.com/advancedui/gfxdaolist.zip">download dao dynamic
link list in a formview</A> 635<BR></P>
<P><A href="http://go1.163.com/~81000/source/adv_ui/gfxviewlist.zip"
tppabs="http://www.codeguru.com/advancedui/gfxviewlist.zip">download gfxlistctrl
as a clistview (unsupported)</A> 373k<BR><BR><IMG alt="the list control (14 k)"
height=283 src="gfxlist.shtml.files/gfxlist.gif" width=588
tppabs="http://www.codeguru.com/advancedui/gfxlist.gif"><BR>this is an enhanced
version of the list control; it include some features from other codeguru's
articles. i would especially name zafir's articles and sam fugarino's (his
article enlightened me about database & list controls). however, a lot of
code comes from other people, too much to be all named here. so please don't say
i stole code! i put it here and everybody can take what needed from it.<BR>this
control has the following features:
<UL>
<LI>entire row highlight
<LI>automatic sorting of column (using numeric and text sort)
<LI>support for background../di2001.jpgs and blend highlight selection
<LI>support for vertical and horizontal grid
<LI>draggable column
<LI>customizable column format (size, alignment) with format dialog box
<LI>management of column using column manager
<LI>support for a "categorized view" (like outlook 98)
<LI>support, on every cell, for custom text color, font and grid borders
<LI>automatic saving and loading from registry of column status
<LI>print support
<LI>support for images in cell
<LI>support for images in header
<LI>use a richedit derived control for editing of subitems
<LI>support of subitem editing using a combobox-like control
<LI>automatic copying of items in clipboard
<LI>support for showing scroll bar always
<LI>custom items height (not by single items)
<LI>cell tooltips
<LI>not resizeable columns
<LI>highlight of currently selected cell
<LI>automatic bitmapped popup menus for copy/paste operation in richedit
controls and column format/customize
<LI>support for dinamic dao database link and link of list subitems with other
recordsets with combobox select
<LI>*new* support for item autopreview
<LI>*new* (un)support for clistview </LI></UL>
<H4>1. the list control</H4>
<P>the control has been designed for use with the lpstr_textcallback for
inserting items. it can be used even with normal text insert, but column
manager, column dragging and view by categories are supported only through use
of lpstr_textcallback. the customized text color and fonts, and the categories
handling are managed using callback functions; that means you have to write some
functions in the list parent class (in the demo, a form view) to handle those
features. </P>
<H4>2. creating the list control</H4>
<P>if the control is being created from a form view or a dialog, you'll have to
manually call this function (assuming the control is wndlist):<BR><FONT
color=#990000><TT>wndlist.oninit();</TT></FONT><BR>this because the wm_create
will not be sent when the control is "auto" created; it is not necessary if it
is manually created using the standard create() function. after creating, you
can define the internal styles of the control using the modifyflag() function;
those are the flags you can use:
<UL>
<LI><FONT color=#990000>fhighrowselect</FONT> - selection of full row
<LI><FONT color=#990000>fvertgrid</FONT> - enable vertical grid lines
<LI><FONT color=#990000>fhorizgrid</FONT> - enable horizontal grid lines
<LI><FONT color=#990000>fautosort</FONT> - auto sorting on columns
<LI><FONT color=#990000>fexinfo</FONT> - enable custom colors and fonts for
cells
<LI><FONT color=#990000>fsubitemimages</FONT> - enable images in cells
<LI><FONT color=#990000>fallowmultichange</FONT> - enable to extend the
changes made to an item to all the items actually selected
<LI><FONT color=#990000>fallowdivider</FONT> - enable custom grid lines
<LI><FONT color=#990000>fcelltooltip</FONT> - enable cells tooltip
<LI><FONT color=#990000>fexinfoonrow</FONT> - the custom colors and fonts are
to be asked for line and not for cell (faster than for cell)
<LI><FONT color=#990000>freturndblclk</FONT> - the enter key will be handled
has a left mouse button double click on selected item
<LI><FONT color=#990000>freturnmodify</FONT> - if the currently selected cell
supports editing, the enter key will start the editing
<LI><FONT color=#990000>fscrollbaralways</FONT> - show the scroll bars always
(gives a better look if ws_ex_staticedge is selected) </LI></UL>
<P>by default, those flags are setted in the list control constructor: <FONT
color=#990000>fhighrowselect, fvertgrid, fhorizgrid, fautosort, fexinfo,
fsubitemimages, fcelltooltip, freturnmodify, freturndblclk,
fscrollbaralways</FONT>.</P>
<P>the modifyflag has the same syntax of cwnd::modifystyle(flag_to_be_removed,
flag_to_be_added, redraw_flag).</P>
<H4>3. the column manager</H4>
<P>the list control implements a column manager; this permits column customize
and column dragging. to use this feature we need to first define all the columns
we can have, then specifing the columns we want to be shown and finally setting
them up.
<UL>
<LI><B>a. defining the columns we can have</B><BR>usually done in the view
oninitialupdate or in the dialog oninitdialog, the definition of the columns
is done with the function <FONT color=#990000>definecolumn()</FONT>. this
function as the following syntax:<BR><TT><FONT color=#990000>int definecolumn
(const int iid, const char * ctext, const char * ctextdt, const int ialign,
const int iwidth, dword dwdata, const int iimage, const char *
cdescr)</FONT></TT><BR>iid is the identifier of the column, ctext is the
description of the column, ctextdt is here for internal use only - set it to
null, ialign is the alignment of the column as normally defined for list
controls - lvcfmt_left, lvcfmt_center, .., iwidth is the default width of the
column (don't use -1, put a value instead), dwdata are the flags of the column
as defined below, iimage is the index of the column image if any, cdescr is
the description of the column if it is an image column.<BR>this function is
from the class cgfxcolumnmanager; the cgfxcolumnmanager object is created and
handled by the list control. you can have access to it using:<BR><TT><FONT
color=#990000>cgfxcolumnmanager * pmanager =
wndlist.createcolumnmanager();</FONT></TT><BR>(for the first time you access
it) and <BR><TT><FONT color=#990000>cgfxcolumnmanager * pmanager =
wndlist.getcolumnmanager();</FONT></TT><BR>elsewhere.<BR>
<UL>
<LI><FONT color=#990000>fhcombobox</FONT> - cells of column are editable
06_abcd.zip_list_list 控件_list control控件_list控件_增强control list
版权申诉
3 浏览量
2022-09-23
22:36:39
上传
评论
收藏 43KB ZIP 举报
四散
- 粉丝: 49
- 资源: 1万+
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈