怎样把目录树的内容输到报表同样以目录树的形式打印???
解决方案 »
- 怎样在edit组件里设置固定值,根据条件的不同?????菜鸟请教···
- 【初学问题】用delphi编写dll,内部函数如何调用?
- delphi7.0里用select从SQLServe2000表中查询记录并返回到listview组件时遇到问题,请帮忙
- 大家请近来看看,能帮忙的尽量帮我一下,分不够可以再加,绝不食言!
- 问一个 F1Book 的问题
- delphi7还要不要使用
- 如何实现程序窗口最小化隐藏?
- ado连接SQLSERVER的问题!请帮忙!100分哦
- 超酷话题:谈谈你对面向对象的数据库的展望。不进来看看绝对后悔!
- DBGrid显示mssql数据库中的表的时候,为什么只显示一部分(5,6个字段的样子)字段??
- 散分!
- FloatToStr()里面的参数有什么要求?
TThickness = -1..+1;const
cGBGridList: array[TThickness, TThickness, TThickness, TThickness] of WideString =
((
(('┼', '├', '┽'), ('┴', '└', '┵'), ('╁', '┟', '╅')),
(('┤', '│', '┥'), ('┘', '↑', '┙'), ('┧', '︾', '┪')),
(('┾', '┝', '┿'), ('┶', '┕', '┷'), ('╆', '┢', '╈'))),
(
(('┬', '┌', '┭'), ('─', '→', '《'), ('┰', '┎', '┱')),
(('┐', '↓', '┑'), ('←', ' ', '<'), ('┒', '∨', '┓')),
(('┮', '┍', '┯'), ('》', '>', '━'), ('┲', '┏', '┳'))),
(
(('╀', '┞', '╃'), ('┸', '┖', '┹'), ('╂', '┠', '╉')),
(('┦', '︽', '┩'), ('┚', '∧', '┛'), ('┨', '┃', '┫')),
(('╄', '┡', '╇'), ('┺', '┗', '┻'), ('╊', '┣', '╋'))));function TreeViewToDisplay(mTreeView: TTreeView; mStrings: TStrings;
mHBold: Boolean = True; mVBold: Boolean = True): Boolean;
{ 将可视树转换成可视方式 }
var
I, J: Integer;
T, S: string;
H, V: Integer;
vTreeNode: TTreeNode;
begin
Result := False;
if not Assigned(mTreeView) then Exit;
if not Assigned(mStrings) then Exit;
mStrings.Clear;
H := Iif(mHBold, +1, -1);
V := Iif(mVBold, +1, -1);
J := 0;
with mTreeView do try
for I := 0 to Pred(Items.Count) do begin
if J > Items[I].Level then
T := Copy(T, 1, Length(T) - (J - Items[I].Level) * 2)
else if J < Items[I].Level then T := T + S;
vTreeNode := Items[I].GetNextSibling;
if not Assigned(vTreeNode) then begin
mStrings.Add(T + cGBGridList[V, H, 00, 00] + Items[I].Text);
S := cGBGridList[00, 00, 00, 00];
end else begin
mStrings.Add(T + cGBGridList[V, H, V, 00] + Items[I].Text);
S := cGBGridList[V, 00, V, 00];
end;
J := Items[I].Level;
end;
except
Exit;
end;
Result := True;
end; { TreeViewToDisplay }
///////End Source///////Begin Demo
procedure TForm1.Button1Click(Sender: TObject);
begin
TreeViewToDisplay(TreeView1, Memo1.Lines, CheckBox1.Checked, CheckBox2.Checked);
end;
///////End Demo
H := Iif(mHBold, +1, -1);
V := Iif(mVBold, +1, -1);
会不会写错阿?谢谢你的帮忙!!!
function Iif(mBool: Boolean; mDataA, mDataB: Variant): Variant;
begin
if mBool then
Result := mDataA
else Result := mDataB;
end; { Iif }