有沒有人使用過Delphi 2009的TCategoryPanelGroup組件,特別是動態添加按鈕到類別面板?如何動態添加按鈕到TCategoryPanelGroup?
我無法讓它正常工作。無論是按鈕不出現或對齊被搞砸。我想要做的基本輪廓:
procedure AddButton (const Caption, Group : String);
const
ButtonSize = 55;
Border = 10;
var
CategoryPanel : TCategoryPanel;
Button : TButton;
begin
CategoryPanel := FindCategoryPanel (CategoryPanelGroup, Group);
CategoryPanel.Height := CategoryPanel.Height + ButtonSize + Border;
Button := TButton.Create (CategoryPanel);
Button.Parent := CategoryPanel;
Button.Width := ButtonSize;
Button.Height := ButtonSize;
Button.Left := 27;
Button.Top := CategoryPanel.ClientHeight - Border - ButtonSize;
end;
任何提示?
而且在高度上還有一個像素偏移量。 – 2009-08-27 13:30:10
在實際應用中,按鈕是TButton的子類,它們包含圖像。 – jpfollenius 2009-08-27 13:34:07
確切的問題:按鈕沒有出現在正確的位置。它們要麼完全不出現,要麼只有很小的偏移,而是彼此重疊。 – jpfollenius 2009-08-27 13:36:47