锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久超碰97人人做人人爱,欧美久久天天综合香蕉伊,狠狠色丁香婷婷久久综合http://www.shnenglu.com/Tauruser/category/3682.htmlEnjoy Every Dayzh-cnMon, 19 May 2008 21:04:01 GMTMon, 19 May 2008 21:04:01 GMT60CListCtrl For Beginners(杞澆)http://www.shnenglu.com/Tauruser/archive/2007/03/07/19381.htmlTauruserTauruserWed, 07 Mar 2007 13:23:00 GMThttp://www.shnenglu.com/Tauruser/archive/2007/03/07/19381.htmlhttp://www.shnenglu.com/Tauruser/comments/19381.htmlhttp://www.shnenglu.com/Tauruser/archive/2007/03/07/19381.html#Feedback0http://www.shnenglu.com/Tauruser/comments/commentRss/19381.htmlhttp://www.shnenglu.com/Tauruser/services/trackbacks/19381.htmlThe List Control (MFC CListCtrl class) is the type of control that the Windows Explorer uses for it's right-side pane, but figuring out how to use the control can be a different kind of pain. The control is usually used only in "report view", which provides columns for each item. The following shows the basics of adding data to a List Control:

聽聽聽聽 int 聽Index;
// 聽Insert聽columns
ListCtrl.InsertColumn( 0 ,聽 " One " ,聽LVCFMT_LEFT,聽 - 1 ,聽 0 );
ListCtrl.InsertColumn(
1 ,聽 " Two " ,聽LVCFMT_LEFT,聽 - 1 ,聽 1 );
// 聽Insert聽first聽row
Index聽 = 聽ListCtrl.InsertItem(LVIF_TEXT,聽 0 ,聽 " One聽one " ,聽 0 ,聽 0 ,聽 0 ,聽NULL);
ListCtrl.SetItem(Index,聽
1 ,聽LVIF_TEXT,聽 " One聽two " ,聽 0 ,聽 0 ,聽 0 ,聽NULL);
// 聽Insert聽second聽row
Index聽 = 聽ListCtrl.InsertItem(LVIF_TEXT,聽 1 ,聽 " Two聽one " ,聽 0 ,聽 0 ,聽 0 ,聽NULL);
ListCtrl.SetItem(Index,聽
1 ,聽LVIF_TEXT,聽 " Two聽two " ,聽 0 ,聽 0 ,聽 0 ,聽NULL);
// 聽Set聽column聽widths聽(an聽optional聽nice聽touch)
ListCtrl.SetColumnWidth( 0 ,聽LVSCW_AUTOSIZE);
ListCtrl.SetColumnWidth(
1 ,聽LVSCW_AUTOSIZE);

If you are using CListView, then you will need to use something such as the following to access the CListCtrl:

CListCtrl聽&ListCtrl聽=聽GetListCtrl();

Note that for these to work, the control must have the "LVS_REPORT" style. For list controls in dialogs, including dialogs for CFormView, this style can be set in the dialog editor. If you are using CListView or you are creating list controls using Create, the style can be set in a PreCreateWindow override, as in:

BOOL聽CDumpView::PreCreateWindow(CREATESTRUCT&聽cs)聽{
cs.style聽
|=聽LVS_REPORT;
return聽CListView::PreCreateWindow(cs);
}


Getting a Count of Columns

The solution for determining the number of columns is not obvious. You must get the header control from the list control and get the number of items (rows) in the header control. So I suggest putting the following in your header:

CHeaderCtrl聽*GetHeaderCtrl()聽const{return聽(CHeaderCtrl*)GetDlgItem(0);};
int聽GetColumnsCount()聽const{return聽GetHeaderCtrl()->GetItemCount();};


Deleting All Columns

Using GetColumnsCount() from above, it is easy to delete all columns.

void聽CListControl::DeleteAllColumns()聽{
聽聽聽聽
int聽i,聽n;
n聽
=聽GetColumnsCount();
for聽(i=0;聽i<n;聽++i)
聽聽聽聽DeleteColumn(
0);
}

Confusing Terminology


Microsoft has made things very confusing because the Platform SDK name for a listbox is "ListBox Control" but MFC programmers usually use "list control" to refer to an instance of the CListCtrl class, which is confusing. Also, the MFC class name for a "List View Control" is CListCtrl and CListView is the view class for it. The MFC class name for a "ListBox Control" is CListBox so we would expect the view class for it to also be CListView except there is not a view class. The following summarizes this.

Platform SDK name:List Boxes
Window class name: ListBox (See under "Predefined Controls" in User Controls and the documentation for CreateWindow and CreateWindowEx)
MFC class name:CListBox
MFC view class name: none

Platform SDK name:ListView Control
Window class name: SysListView32 (use WC_LISTVIEW in source code instead, which is defined as "SysListView32")
MFC class name:CListCtrl
MFC view class name:CListView

























Tauruser 2007-03-07 21:23 鍙戣〃璇勮
]]>
MFC ComboBox 浣跨敤鏂規(guī)硶錛堣漿杞斤級http://www.shnenglu.com/Tauruser/archive/2007/02/28/19038.htmlTauruserTauruserWed, 28 Feb 2007 02:29:00 GMThttp://www.shnenglu.com/Tauruser/archive/2007/02/28/19038.htmlhttp://www.shnenglu.com/Tauruser/comments/19038.htmlhttp://www.shnenglu.com/Tauruser/archive/2007/02/28/19038.html#Feedback3http://www.shnenglu.com/Tauruser/comments/commentRss/19038.htmlhttp://www.shnenglu.com/Tauruser/services/trackbacks/19038.htmlMFC ComboBox 浣跨敤鏂規(guī)硶錛堣漿杞斤級

Combo box controls are space savers. Wherever there is no need for a multi-select from a list of items, combo box is a good choice in such places. This article " CComboBox Example" explains how to use the MFC CComboBox class for manipulation of a list of strings.

CComboBox Example - Initializing a Combo Box:

聽聽 It is assumed that the readers of the sample have already created a dialog box (either in a dialog based application or SDI/MDI application) and placed a combo box control from the controls toolbox on the Resource Editor.

聽聽 After placing the combo box control on the dialog box, open the class wizard by pressing Ctrl + W keys or Menu --> View --> ClassWizard. In the Member Variables tab, Add a Variable for the CComboBox class. This CComboBox example assumes that the variable name is,

聽聽聽聽聽 CComboBox聽 m_cbExample;

聽聽 This m_cbExample will be used further in our CComboBox example MFC code.

CComboBox Example - Adding Items to a Combo Box:

聽聽 The function AddString is used for adding items to a combo box. If there is a constant set of data, these values can also be added in the Resource Editor itself. The Combo Box control properties dialog has a tab for adding data. Otherwise the data can be added as follows.

聽聽聽 m_cbExample.AddString("StringData1");
聽聽聽 m_cbExample.AddString("StringData2");
聽聽聽 m_cbExample.AddString("StringData3");

CComboBox Example - Retrieving Items from a Combo Box:

聽聽 Usually
a requirement for retrieving items from the combo box will arise from selecting the data. This article also assumes the same. Now the data selected in a combo box needs to be retrieved.

聽聽 To do this, the first step is to find out the index of the selected item inside the combo box control.
Then the item at the corresponding position needs to be pulled out as follows.


聽聽聽 int nIndex = m_cbExample.GetCurSel();
聽聽聽 CString strCBText;

聽聽聽 m_cbExample.GetLBText(
nIndex, strCBText);


聽聽 In the above CComboBox example code, the value will be retrieved and stored in strCBText variable. There is another overloaded version for GetLBText. But the version which uses CString is the easiest one.


CComboBox Example - Finding Items inside a Combo Box:


聽聽 This kind of Find operations on a Combo box will most probably be useful in programs that dynamically modify the values in a combo box. The function FindStringExact is used to find the exact string match inside a combo box.


聽聽聽 int nIndex = m_cbExample.FindStringExact(0, "Value to be found");

聽聽 The string position inside the combo box control is the return value. It returns CB_ERR if it was unsuccessful in finding the string.


CComboBox Example - Deleting Items from a Combo Box:


聽聽聽 This operation can be done by using the CCombobox member function DeleteString. This function needs the index of the item inside the combo box.


聽聽聽聽 m_cbExample
.DeleteString(nIndex);



Tauruser 2007-02-28 10:29 鍙戣〃璇勮
]]>
偷窥少妇久久久久久久久| 亚洲精品乱码久久久久久久久久久久| 国产精自产拍久久久久久蜜| 狠狠88综合久久久久综合网| 国产午夜福利精品久久2021| 人妻无码αv中文字幕久久| 国产精品久久久天天影视香蕉| 香港aa三级久久三级| 日韩精品无码久久久久久| 久久国产精品无码一区二区三区 | 色婷婷综合久久久久中文| 日日躁夜夜躁狠狠久久AV| 久久国产成人精品麻豆| 一级女性全黄久久生活片免费| 久久中文骚妇内射| 麻豆精品久久精品色综合| 久久精品aⅴ无码中文字字幕不卡 久久精品aⅴ无码中文字字幕重口 | 欧美午夜A∨大片久久| 97精品依人久久久大香线蕉97| 国产成人精品久久二区二区| 久久久精品国产免大香伊| 久久久99精品成人片中文字幕 | 精品国产乱码久久久久久郑州公司| 国产精品九九九久久九九| 亚洲欧洲日产国码无码久久99| 久久精品国产精品青草app| 中文字幕久久亚洲一区| 久久精品国产72国产精福利| 72种姿势欧美久久久久大黄蕉| 香蕉久久永久视频| 99久久成人18免费网站| 伊人久久精品线影院| 久久国产乱子伦免费精品| 久久国产精品成人片免费| 人妻无码中文久久久久专区| 久久精品国产2020| 性高湖久久久久久久久AAAAA| 精品久久人人妻人人做精品| 久久99久久无码毛片一区二区| 国产69精品久久久久久人妻精品| 亚洲va国产va天堂va久久|