⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 non_report_subitem.shtml.htm

📁 mfc资料集合5
💻 HTM
字号:
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="Author" CONTENT="Zafir Anjum">
   <TITLE>CListCtrl - Using sub-stings in non report view</TITLE>
</HEAD>
<body background="../fancyhome/back.gif" tppabs="http://www.codeguru.com/fancyhome/back.gif" bgcolor="#FFFFFF" link="#B50029" vlink="#8E2323" alink="#FF0000" bgproperties="fixed">
<table WIDTH="100%">
<tr WIDTH="100%">
<td><A HREF="http://209.66.99.126/cgi/ads.cgi?advert=myad2"><IMG SRC="../../209.66.99.126/advertise2.gif" tppabs="http://209.66.99.126/advertise2.gif" ALT="" BORDER=2></A><td>
</tr>
</table>


<CENTER>
<H3>
<FONT COLOR="#AOAO99">Using sub-stings in non report view</FONT></H3></CENTER>

<HR WIDTH="100%">

This top was contributed by <A HREF="mailto:carsten.witte@ploe.comcity.de">Carsten Witte</A>.


<P>I wanted a CListCtrl in icon view mode only (no switch to other view
modes), but tried to "store" additional string information in subitems. 

<P>So I've useed  used ...
<PRE><TT><FONT COLOR="#990000">
        SetItemText (nIndex, 1, strMoreInfo)
</FONT></TT></PRE>

and according to the help it returned Nonzero for "successful". but then
later on when I tried to use that string with

<PRE><TT><FONT COLOR="#990000">
        GetItemText (iItem, 1);
</FONT></TT></PRE>

it return sucessful with nothing. :( The string was gone.

<P>To make a long story short, one can't store subitems without a header. So
an easy solution is to define two "blind" headers like ...

<PRE><TT><FONT COLOR="#990000">
        for(int iHeader=0; iHeader < 2; iHeader++)
        {
                InsertColumn (iHeader, "header", LVCFMT_LEFT, -1, iHeader);
        }
</FONT></TT></PRE>

and you can store whatever string you want in subitem.

<P>
<HR>
<TABLE BORDER=0 WIDTH="100%" >
<TR>
<TD WIDTH="33%"><FONT SIZE=-1><A HREF="../index.htm" tppabs="http://www.codeguru.com/">Goto HomePage</A></FONT></TD>

<TD WIDTH="33%">
<CENTER><FONT SIZE=-2>&copy; 1997 Zafir Anjum</FONT>&nbsp;</CENTER>
</TD>

<TD WIDTH="34%">
<DIV ALIGN=right><FONT SIZE=-1>Contact me: <A HREF="mailto:zafir@home.com">zafir@home.com</A>&nbsp;</FONT></DIV>
</TD>
</TR>
</TABLE>
<CENTER><FONT SIZE=-2>6642</FONT></CENTER>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -