D7控件\dw_cd_VirtualTreeview_v4.5.2\Demos\Advanced---TVirtualStringTree用法

VST1: TVirtualStringTree;
//按钮公用函数,根据不同 标签tag区分,
Screen.Cursor := crHourGlass; //设置屏幕鼠标的形状为crhourGlass
with VST1 do
try
Start := GetTickCount; // Start: Cardinal;
case (Sender as TButton).Tag of
0: // add to root
begin
Count := StrToInt(NodeCountEdit.Text);
RootNodeCount := Integer(RootNodeCount) + Count; //TVirtualStringTree的属性,写函数写好添加功能
end;
1: // add as child
if Assigned(FocusedNode) then
begin
Count := StrToInt(NodeCountEdit.Text);
ChildCount[FocusedNode] := Integer(ChildCount[FocusedNode]) + Count; //TVirtualStringTree的属性,写函数写好添加子项功能
Expanded[FocusedNode] := True;
InvalidateToBottom(FocusedNode);
end;
end;
Label1.Caption := Format('Last operation duration: %d ms', [GetTickCount - Start]);//计算耗时毫秒
Label3.Caption := Format('Nodes in tree: %d', [VST1.TotalCount]);
finally
Screen.Cursor := crDefault;//恢复光标
end;
-------------------
VST1.Clear; //清除
VST1.DeleteSelectedNodes;//删除 所选择的项
VST1.TreeOptions.PaintOptions + [toShowBackground] //在子集里面添加可以显示背景图
------------------
begin
with OPD do //TOpenPictureDialog
begin
if Execute then
begin
VST1.Background.LoadFromFile(FileName); //加载背景图片,貌似bmp格式会好些
// VST1.Invalidate //隐藏背景图
end;
end;
end; ----------------
通过TRadioGroup的第二个单选,巧妙地:
with VST2.TreeOptions do
if ThemeRadioGroup.ItemIndex = 0 then
PaintOptions := PaintOptions + [toThemeAware] //添加子集
else
PaintOptions := PaintOptions - [toThemeAware];
RadioGroup1.Enabled := ThemeRadioGroup.ItemIndex = 1; //巧妙地取为 boolean类型
RadioGroup2.Enabled := ThemeRadioGroup.ItemIndex = 1;
---------------
TCheckImageKind = ( //定义的枚举类型
ckLightCheck, // gray cross
ckDarkCheck, // black cross
ckLightTick, // gray tick mark
ckDarkTick, // black tick mark
ckFlat, // flat images (no 3D border)
ckXP, // Windows XP style
ckCustom, // application defined check images
ckSystem, // System defined check images.
ckSystemFlat // Flat system defined check images.
);
VST2.CheckImageKind := TCheckImageKind(CheckMarkCombo.ItemIndex);//通过combobox的值巧妙地取出枚举类型值并赋值给
-------------
with Sender as TCheckBox, AlignTree.Header do
Options := Options + [hoShowImages];//显示图像
Options := Options + [hoVisible] //可以显示表格 头标题 [coEnabled]是否可以失效
ChangeHeaderText; //显示文字或隐藏
----------------
可以做像预览的效果,当页面上无法完全显示时,可以浮动显示整个字段。--有待分析。
Label显示多行字还是不错的,比Memo好看,但后者可以复制操作等。
-------------
Columns = < //设定里面的每一栏 是否可以点击或高亮显示,--有待分析。
item
ImageIndex = 1
Options = [coDraggable, coEnabled, coResizable, coShowDropMark, coVisible]
Position = 0
Spacing = -1
Width = 200
WideText = 'Default drawing'
WideHint = 'This column is drawn entirely by the tree.'
end

  

上一篇:linux 系统调用sysconf【总结】


下一篇:面向对象第一个特征-封装(Encapsulation)