2025-11-27 16:46:48 +09:00

88 lines
11 KiB
Plaintext

{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f40\froman\fcharset238\fprq2 Times New Roman CE;}
{\f41\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f43\froman\fcharset161\fprq2 Times New Roman Greek;}{\f44\froman\fcharset162\fprq2 Times New Roman Tur;}{\f45\froman\fcharset177\fprq2 Times New Roman (Hebrew);}
{\f46\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f47\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f48\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*\cs10 \additive \ssemihidden
Default Paragraph Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rsidtbl \rsid5183391\rsid7801115}
{\*\generator Microsoft Word 11.0.5604;}{\info{\author TvmServer}{\operator TvmServer}{\creatim\yr2005\mo1\dy17\hr12\min32}{\revtim\yr2005\mo1\dy17\hr12\min32}{\version2}{\edmins0}{\nofpages3}{\nofwords734}{\nofchars4184}{\*\company Dundas India}
{\nofcharsws4909}{\vern24689}}\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3
\jcompress\viewkind1\viewscale100\nolnhtadjtbl\rsidroot7801115 \fet0\sectd \linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3
\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}
{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain
\ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\b\fs48\cf2\insrsid7801115 COXListBoxEx Overview}{\b\fs48\insrsid7801115
\par }{\b\fs15\insrsid7801115 Copyright \'a9 }{\b\fs15\insrsid7801115 The Code Project}{\b\fs15\insrsid7801115 1997-1999, All Rights Reserved
\par }{\insrsid7801115
\par }{\b\insrsid7801115 COXListBoxEx}{\insrsid7801115 is }{\b\insrsid7801115 CListBox}{\insrsid7801115 derived class that provides a lot of additional functionality that might be at different circumstances. New features mostly have to do with
the way list box items are displayed. Using this class you can set }{\b\insrsid7801115 images}{\insrsid7801115 to be displayed altogether with text. You can easily assign any }{\b\insrsid7801115 font}{\insrsid7801115 , }{\b\insrsid7801115 text}{
\insrsid7801115 and }{\b\insrsid7801115 background}{\insrsid7801115 color, }{\b\insrsid7801115 indention}{\insrsid7801115 from the left side for any item in a list box. Also you can assign a }{\b\insrsid7801115 tooltip}{\insrsid7801115 to any item so
\~whenever mouse is moved in the item rectangle the corresponding tooltip will be displayed. You can specify background color and tooltip for the\~
\par list box control as well.
\par
\par COXListBoxEx class introduces new functionality that might be especially useful in combo box control (to use COXListBoxEx derived class as combo box dropdown list box). This functionality allows you to assign some items as }{\b\insrsid7801115
Most Recent Used (MRU)}{\insrsid7801115 items. }{\b\insrsid7801115 MRU}{\insrsid7801115 items always reside at the top of the list and separated fro
m the rest of the items by separator (line is drawn between last MRU and first normal items). COXListBoxEx allows you to specify the maximum number of MRU items. And also it supports the functionality of saving and restoring MRU items to/from the registry
.
\par }{\b\insrsid7801115
\par
\par Usage
\par
\par }{\insrsid7801115
In order to use COXListBoxEx object in your application you have to create it using standard CListBox::Create function or subclass the existing control (e.g. using DDX/DDV technology). When creating control explicitly or defining it in dialog tem
plate you have to make sure that the following requirements are met:
\par
\par }\pard \ql \li720\ri720\nowidctlpar\faauto\rin720\lin720\itap0 {\b\insrsid7801115 LBS_OWNERDRAWVARIABLE }{\insrsid7801115 style }{\b\ul\insrsid7801115 must}{\insrsid7801115 be specified
\par if control is supposed to display text then }{\b\insrsid7801115 LBS_HASSTRINGS}{\insrsid7801115 style }{\b\ul\insrsid7801115 must}{\insrsid7801115 be specified
\par
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid7801115
After control was successfully created or subclassed you might want to populate it with items. The process of adding new items is exactly the same as for the standard CListBox control. We extended standard declaration of some functions in order to accommo
date new functionality. Use following functions in order to add or insert new item:
\par
\par }\pard \ql \li720\ri720\nowidctlpar\faauto\rin720\lin720\itap0 {\insrsid7801115 int }{\ul\cf2\insrsid7801115 AddString}{\insrsid7801115 (LPCTSTR lpszItem, int nMask, OXLISTBOXITEM* pLBI);
\par int }{\ul\cf2\insrsid7801115 AddString}{\insrsid7801115 (LPCTSTR lpszItem, int nMask=0, CFont* pFont=NULL, COLORREF clrText=::GetSysColor(COLOR_WINDOW
TEXT), COLORREF clrBackground=::GetSysColor(COLOR_WINDOW), CString sTooltipText=_T(""), int nImageIndex=-1,\~ int nIndent=0);
\par int }{\ul\cf2\insrsid7801115 InsertString}{\insrsid7801115 (int nIndex, LPCTSTR lpszItem, int nMask, OXLISTBOXITEM* pLBI);
\par int }{\ul\cf2\insrsid7801115 InsertString}{\insrsid7801115 (int nIndex, LPCTSTR lpszItem, int
nMask=0, CFont* pFont=NULL, COLORREF clrText=::GetSysColor(COLOR_WINDOWTEXT), COLORREF clrBackground=::GetSysColor(COLOR_WINDOW), CString sTooltipText=_T(""), int nImageIndex=-1, int nIndent=0);
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid7801115
\par As you can see you can specify all new item settings at the moment this item is added.
\par
\par
\par You can change any item property at runtime using the following functions:
\par }\pard \ql \li720\ri720\nowidctlpar\faauto\rin720\lin720\itap0 {\insrsid7801115 BOOL }{\ul\cf2\insrsid7801115 SetItemInfo}{\insrsid7801115 (int nIndex, int nMask, OXLISTBOXITEM* pLBI);
\par virtual BOOL }{\ul\cf2\insrsid7801115 SetItemInfo}{\insrsid7801115 (int nIndex, int nMask=0, CFont* pFont=NULL, COLORREF clrText=::Ge
tSysColor(COLOR_WINDOWTEXT), COLORREF clrBackground=::GetSysColor(COLOR_WINDOW), CString sTooltipText=_T(""), int nImageIndex=-1, int nIndent=0);
\par BOOL }{\ul\cf2\insrsid7801115 SetItemFont}{\insrsid7801115 (int nIndex, CFont* pFont);
\par BOOL }{\ul\cf2\insrsid7801115 SetItemTextColor}{\insrsid7801115 (int nIndex, COLORREF clrText);
\par BOOL }{\ul\cf2\insrsid7801115 SetItemBkColor}{\insrsid7801115 (int nIndex, COLORREF clrBackground);
\par BOOL }{\ul\cf2\insrsid7801115 SetItemImageIndex}{\insrsid7801115 (int nIndex, int nImageIndex);
\par BOOL }{\ul\cf2\insrsid7801115 SetItemIndent}{\insrsid7801115 (int nIndex, int nIndent);
\par BOOL }{\ul\cf2\insrsid7801115 SetItemTooltipText}{\insrsid7801115 (int nIndex, CString sTooltipText);
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid7801115
\par You can retrieve any item property at runtime using the following functions:
\par }\pard \ql \li720\ri720\nowidctlpar\faauto\rin720\lin720\itap0 {\insrsid7801115 OXLISTBOXITEM* }{\ul\cf2\insrsid7801115 GetItemInfo}{\insrsid7801115 (int nIndex) const;
\par CFont* }{\ul\cf2\insrsid7801115 GetItemFont}{\insrsid7801115 (int nIndex) const;
\par COLORREF }{\ul\cf2\insrsid7801115 GetItemTextColor}{\insrsid7801115 (int nIndex) const;
\par COLORREF }{\ul\cf2\insrsid7801115 GetItemBkColor}{\insrsid7801115 (int nIndex) const;
\par int }{\ul\cf2\insrsid7801115 GetItemImageIndex}{\insrsid7801115 (int nIndex) const;
\par int }{\ul\cf2\insrsid7801115 GetItemIndent}{\insrsid7801115 (int nIndex) const;
\par CString }{\ul\cf2\insrsid7801115 GetItemTooltipText}{\insrsid7801115 (int nIndex) const;
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid7801115
\par You can specify a background color of the control using:
\par }\pard \ql \li720\ri720\nowidctlpar\faauto\rin720\lin720\itap0 {\insrsid7801115 void }{\ul\cf2\insrsid7801115 SetBkColor}{\insrsid7801115 (COLORREF clrBackground);
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid7801115
\par And tooltip for the control can be set using:
\par }\pard \ql \li720\ri720\nowidctlpar\faauto\rin720\lin720\itap0 {\insrsid7801115 BOOL }{\ul\cf2\insrsid7801115 SetItemTooltipText}{\insrsid7801115 (int nIndex, CString sTooltipText);
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid7801115
\par We already mentioned MRU items paradigm that is supported by COXListBoxEx class. Here is the list of functions that can be used in order to specify maximum number of MRU items, to move/remove items to/from the MRU section and to save and re
store the state of MRU items:
\par }\pard \ql \li720\ri720\nowidctlpar\faauto\rin720\lin720\itap0 {\insrsid7801115 int }{\ul\cf2\insrsid7801115 MRUAdd}{\insrsid7801115 (int nItemIndex) ;
\par int }{\ul\cf2\insrsid7801115 MRUMove}{\insrsid7801115 (int nMRUIndex, int nMRUIndexNew);\~
\par virtual int }{\ul\cf2\insrsid7801115 MRUInsert}{\insrsid7801115 (int nItemIndex, int nMRUIndex, BOOL bForceToInsert=TRUE);
\par virtual int }{\ul\cf2\insrsid7801115 MRUDelete}{\insrsid7801115 (int nMRUIndex);
\par void }{\ul\cf2\insrsid7801115 SetSaveRestoreMRUState}{\insrsid7801115 (BOOL bSaveRestore);
\par BOOL }{\ul\cf2\insrsid7801115 GetSaveRestoreMRUState}{\insrsid7801115 () const;
\par }\pard \ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid7801115 \~
\par Even greater level of customization can be achieved through deriving your own class from COXListBoxEx. This class has a big set of protected virtual functions that are responsible for implementing clas
s features. By overriding those functions you can provide your own logic in the control. Refer to }{\ul\cf2\insrsid7801115 class reference}{\insrsid7801115 for details.}{\fs20\insrsid7801115
\par }}