1

我正在寻找更改 DevComponent AdvTree 上特定节点的字体颜色。我在 DevComponents 的“知识库”中找到了以下与改变风格有关的信息:

// Create new style
ElementStyle styleRightAligned = new ElementStyle();

// Set text alignment to right

styleRightAligned.TextAlignment = eStyleTextAlignment.Far;

advTree1.Styles.Add(styleRightAligned);

// Add new cell to the AdvTree

Cell cell = new Cell();

cell.Text = "Right";
cell.StyleNormal = styleRightAligned;

// Assign style to cell, same style can be assigned to any number of cells

node1.Cells.Add(cell);

我无法理解 eStyleAlignment.Far 中引用了什么对象。

有没有人有在 DevComponents DotNetBar 中更改样式的经验?

谢谢,

安迪

4

1 回答 1

1

I figured out how to do this. The AdvTree control has a Styles property. This is a collection; styles can be added to it at design time.

Then the code to change the style of a particular node is:

void ChangeNodeStyle(AdvTree tree, int node, int style)
{
    tree.Nodes[node].Style = tree.Styles[style];
}

Thanks,

Andy

于 2013-04-14T11:46:07.743 回答