通用
新建控件后,先改ID,然后添加变量,再添加控件事件
1
2
3
4
5
|
graph
z([新建控件])-->
改ID-->
添加变量-.->
添加控件事件
|
CDIALOG对话框
新建DIALOG对话框记得添加类
1
2
3
4
5
6
|
graph
z([新建DIALOG对话框])-->
添加类-->
z1[style选child]-->
z2[border重选]-->
z3[添加事件TCN_SELCHANGE]
|
CEdit
详情
CListCtrl
详情
重要参数:
自动排序方法:
- 控件右键添加事件LVN_COLUMNCLICK (类列表不要选错)
- 复制并添加相关代码(代码如下)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
DWORD dwSelColID = 0;
bool bASC = true;
int static CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
CListCtrl* pListCtrl = (CListCtrl*)lParamSort;
LVFINDINFO findInfo;
findInfo.flags = LVFI_PARAM;
findInfo.lParam = lParam1;
int iItem1 = pListCtrl->FindItem(&findInfo, -1);
findInfo.lParam = lParam2;
int iItem2 = pListCtrl->FindItem(&findInfo, -1);
CString strItem1 = pListCtrl->GetItemText(iItem1, dwSelColID);
CString strItem2 = pListCtrl->GetItemText(iItem2, dwSelColID);
int iItem1Value = _ttoi(strItem1);
int iItem2Value = _ttoi(strItem2);
if (bASC)
return iItem1Value > iItem2Value;
else
return iItem1Value < iItem2Value;
}
void CAutoToolTestDlg::OnLvnColumnclickListInfo(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
//if (pNMLV->iSubItem != 0) //只排序指定列
//{
// return;
//}
if (dwSelColID != pNMLV->iSubItem)
{
dwSelColID = pNMLV->iSubItem;
bASC = bASC;
}
else
bASC = !bASC;
int count = m_lstApp.GetItemCount();
for (int i = 0; i < count; i++)
m_lstApp.SetItemData(i, i);
m_lstApp.SortItems(CompareFunc, (LPARAM)(&m_lstApp));
*pResult = 0;
}
|
CListBox
CTabCtrl
CTraceServiceControl
CRichEditCtrl
重要属性:
多行
垂直滚动
CStdioFile 类
class CStdioFile : public CFile
公共构造函数
公共方法
公共数据成员
类视图
1
2
3
4
|
graph
类视图-->消息 & 重写
消息-->WM_TIMER
重写-->OnInitDialog & OnOk & OnCancel & OnWndMsg
|