delphi treeview 控制元件如何資料豎向居中顯示就像二叉樹一樣首節點最上方居中子節點依次在下方
如圖:

或者有什么第三方控制元件也可以
uj5u.com熱心網友回復:
或者重繪能實作也行啊,有沒有大牛個點思路!uj5u.com熱心網友回復:
沒人知道嗎?uj5u.com熱心網友回復:
自己畫,就是幾個圓、箭頭而已uj5u.com熱心網友回復:
同意樓上,自己繪制,思路如下:
//1、確定根節點位置(矩形區域),定義為 ParentRect
//則矩形寬度
W := ParentRect.Right-Parent.Left;
//高度
H := ParentRect.Bottom-Parent.Top;
//為便于計算和理解,宣告一個變數tmpW,表示寬度的一半
tmpW := W div 2;
//2、計算子節點位置,定義為ChildRect。假如子節點數目為n,節點的位置序號為index,則:
//(1)計算矩形的Top、Bottom
ChildRect.Top := ParentRect.Bottom;
ChildRect.Bottom := ChildRect.Top+H;
//(2)計算所有子節點最左邊的位置L
L := ParentRect.Left-((n-1)*tmpW);
//(3)計算所有子節點Left、Right
for Index := 0 to n-1 do begin
ChildRect[index].Left := L+W*index;
ChildRect[index].Right := ChildRect[index].Left+W;
end;
//3、遞回呼叫第2步,即可計算出全部節點的矩形區域
//4、重新計算所有節點的實際繪制區域,留出間隔位置,如:
ChildDrawRect := ChildRect;
With ChildDrawRect do begin
Top := Top + (H div 6);
Bottom := Bottom - (H div 6);
Left := Left + (W div 6);
Right := Right - (W div 6);
end;
//5、繪制子節點與父節點的連接線(略)
uj5u.com熱心網友回復:
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/19226.html
標籤:VCL組件開發及應用
上一篇:光纖問題
下一篇:連接遠程服務器mysql
