Q
question
Unregistered / Unconfirmed
GUEST, unregistred user!
<body bgcolor="#FFFFFF">
<table width="67%" border="0">
<tr>
<td width="44%"><img src="http://lanny.iszero.com/A01.gif" width="257" height="145"></td>
<td width="56%"><img src="http://lanny.iszero.com/A02.gif" width="257" height="145"></td>
</tr>
<tr>
<td width="44%" height="17">
<div align="center"><b>(图一)</b></div>
</td>
<td width="56%" height="17">
<div align="center"><b>(图二)</b></div>
</td>
</tr>
</table>
<p>使用TreeView的 AdvancedCustomDrawItem 方法,</p>
<p>procedure TfrmMain.TreeView1AdvancedCustomDrawItem(Sender: TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState; Stage: TCustomDrawStage; var PaintImages,
DefaultDraw: Boolean); <br>
var NodeRect: TRect; <br>
begin <br>
if Stage = cdPostPaint then begin <br>
if Node.HasChildren then begin <br>
NodeRect := Node.DisplayRect(True); <br>
TreeView1.Canvas.Font.Assign(TreeView1.Font); <br>
TreeView1.Canvas.Font.Color := clBlue; <br>
TreeView1.Canvas.Brush.Style := bsClear; <br>
TreeView1.Canvas.TextOut(NodeRect.Right, NodeRect.Top + 2, '('+InttoStr(Node.Count)+')');
<br>
end; <br>
end; <br>
end; </p>
<p>可以得到图一的效果,可我想统计所有父类包含的所有子列的个数,及得到图二的结果,</p>
<p>不知道如何做!</p>
<p>谢谢!</p>
</body>
<table width="67%" border="0">
<tr>
<td width="44%"><img src="http://lanny.iszero.com/A01.gif" width="257" height="145"></td>
<td width="56%"><img src="http://lanny.iszero.com/A02.gif" width="257" height="145"></td>
</tr>
<tr>
<td width="44%" height="17">
<div align="center"><b>(图一)</b></div>
</td>
<td width="56%" height="17">
<div align="center"><b>(图二)</b></div>
</td>
</tr>
</table>
<p>使用TreeView的 AdvancedCustomDrawItem 方法,</p>
<p>procedure TfrmMain.TreeView1AdvancedCustomDrawItem(Sender: TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState; Stage: TCustomDrawStage; var PaintImages,
DefaultDraw: Boolean); <br>
var NodeRect: TRect; <br>
begin <br>
if Stage = cdPostPaint then begin <br>
if Node.HasChildren then begin <br>
NodeRect := Node.DisplayRect(True); <br>
TreeView1.Canvas.Font.Assign(TreeView1.Font); <br>
TreeView1.Canvas.Font.Color := clBlue; <br>
TreeView1.Canvas.Brush.Style := bsClear; <br>
TreeView1.Canvas.TextOut(NodeRect.Right, NodeRect.Top + 2, '('+InttoStr(Node.Count)+')');
<br>
end; <br>
end; <br>
end; </p>
<p>可以得到图一的效果,可我想统计所有父类包含的所有子列的个数,及得到图二的结果,</p>
<p>不知道如何做!</p>
<p>谢谢!</p>
</body>