📄 gentree.htm
字号:
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 2">
</SPAN>hItem = GetNextVisibleItem(hItem);<O:P></O:P></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1">
</SPAN>}<O:P></O:P></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">}</SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><O:P></O:P></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><B><SPAN
lang=EN-US>3,</SPAN></B><B><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">建立一个基于对话框的程序</SPAN><SPAN
lang=EN-US>,</SPAN></B><B><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">增加一个树状控件</SPAN><SPAN
lang=EN-US>,ctrl + w</SPAN></B><B><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">打开类向导</SPAN><SPAN
lang=EN-US>,</SPAN></B><B><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为它增加一个关联变量</SPAN><SPAN
lang=EN-US>m_tree_ctrl.</SPAN></B></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><B><SPAN
lang=EN-US><O:P></O:P></SPAN></B></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><B><SPAN
lang=EN-US>4,</SPAN></B><B><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对树状控件右键</SPAN><SPAN
lang=EN-US>,</SPAN></B><B><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选取属性</SPAN><SPAN
lang=EN-US>,</SPAN></B><B><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">把</SPAN><SPAN
lang=EN-US>has buttons,has lines,lines at root</SPAN></B><B><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">都选上</SPAN><SPAN
lang=EN-US>.</SPAN></B></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><B><SPAN
lang=EN-US><O:P></O:P></SPAN></B></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><B><SPAN
lang=EN-US>5,</SPAN></B><B><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">手动把</SPAN></B></FONT><B><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">CTreeCtrl<SPAN
style="mso-tab-count: 1">
</SPAN>m_tree_ctrl;</SPAN></B><B><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">改成</SPAN></B><B><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">CMyTree<SPAN
style="mso-tab-count: 1">
</SPAN>m_tree_ctrl;</SPAN></B><B><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">不要忘记了包含头文件</SPAN></B><B><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">,</SPAN></B><B><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: blue; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><O:P></O:P></SPAN></B></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><B><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: blue; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">#include
</SPAN></B><B><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">"MyTree.h"</SPAN></B></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><B><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><O:P></O:P></SPAN></B></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><B><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">6,</SPAN></B><B><SPAN
style="FONT-SIZE: 10pt; COLOR: #000077; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">修改对话框的</SPAN></B><B><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">OnInitDialog</SPAN></B><B><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><O:P></O:P></SPAN></B></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">BOOL
CTestTreeDlg::OnInitDialog()<O:P></O:P></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">{<SPAN
style="mso-tab-count: 1">
</SPAN><O:P></O:P></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1">
</SPAN>…..<O:P></O:P></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1">
</SPAN>HTREEITEM hRootItem = m_tree_ctrl.InsertItem(</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">"</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: #000077; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">五虎上将</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">!"</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">);<O:P></O:P></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1">
</SPAN>m_tree_ctrl.InsertItem(</SPAN><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">"</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: #000077; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">关羽</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">"</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">,hRootItem);<O:P></O:P></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1">
</SPAN>m_tree_ctrl.InsertItem(</SPAN><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">"</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: #000077; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">张飞</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">"</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">,hRootItem);<O:P></O:P></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1">
</SPAN>m_tree_ctrl.InsertItem(</SPAN><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">"</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: #000077; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">赵云</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">"</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">,hRootItem);<O:P></O:P></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1">
</SPAN>m_tree_ctrl.InsertItem(</SPAN><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">"</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: #000077; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">马超</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">"</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">,hRootItem);<O:P></O:P></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><SPAN
style="mso-tab-count: 1">
</SPAN>m_tree_ctrl.InsertItem(</SPAN><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">"</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: #000077; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">黄忠</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: #000077; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">"</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">,hRootItem);<O:P></O:P></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt">}</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; mso-bidi-font-size: 12.0pt; mso-font-kerning: 0pt"><O:P></O:P></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><B><SPAN
lang=EN-US>7,Ctrl + F5.</SPAN></B><B><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">效果如图</SPAN><SPAN
lang=EN-US>.<O:P></O:P></SPAN></B></FONT></P><SPAN lang=EN-US>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><V:SHAPE id=_x0000_i1025
style="WIDTH: 114pt; HEIGHT: 107.25pt" o:ole="" type="#_x0000_t75"><IMG
src="树状控件的应用(选择出阵武将) - VC编程.files/CSDN_Dev_Image_2003-11-111739512.htm"
o:title=""><FONT size=3></FONT></V:SHAPE></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"> </P></SPAN>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><B><SPAN
lang=EN-US>8,</SPAN></B><B><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在资源管理器中增加一个位图</SPAN><SPAN
lang=EN-US>,ID</SPAN></B><B><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为</SPAN><SPAN
lang=EN-US>IDB_STATE.<O:P></O:P></SPAN></B></FONT></P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -