[英]How can I change the size of icons in the Tree control in Flex?
I embed SVG graphics in my Flex application using 我使用SVG图形嵌入了Flex应用程序
package MyUI
{
public class Assets
{
[Embed(source="/assets/pic.svg"]
[Bindable]
public static var svgPic:Class;
}
}
and then extending the Tree class with some of my own code, setting the icon upon adding a node to the data provider: 然后使用我自己的一些代码扩展Tree类,在将节点添加到数据提供程序时设置图标:
public class MyTree extends Tree
{
public function MyTree()
{
// ...
this.iconField = "svgIcon";
// ...
this.dataProvider = new ArrayCollection;
this.dataProvider.addItem({ /* ... */ svgIcon: MyUI.Assets.svgPic /* ... */ });
// ...
}
}
Now I have two things I want to do: 现在我要做两件事:
I read the Flex documentation on the 9-slice scaling properties in the Embed tag, but I think that's not what I want. 我阅读了Embed标签中有关9切片缩放属性的Flex文档,但是我认为这不是我想要的。
Edit: 编辑:
I unsuccessfully checked the "similar questions" suggested by SO, among others this one: 我未成功检查SO建议的“类似问题”,其中包括:
Flex: Modify an embedded icon and use it in a button? Flex:修改嵌入式图标并在按钮中使用它?
Subclass mx.controls.treeClasses.TreeItemRenderer and make it resize the icon to your desired dimensions, or create your own item renderer implementation by using the same interfaces as TreeItemRenderer. 子类mx.controls.treeClasses.TreeItemRenderer,并使其图标调整为所需的尺寸,或者使用与TreeItemRenderer相同的接口创建自己的项目渲染器实现。 Set a custom item renderer with the
itemRenderer
property: 使用
itemRenderer
属性设置自定义项目渲染器:
exampleTree.itemRenderer = new ClassFactory( ExampleCustomItemRendererClass );
The answer to this question might point you in the right direction, without knowing more about the trouble you're having: 这个问题的答案可能会指引您正确的方向,而又不了解您所遇到的麻烦:
Flex: Modify an embedded icon and use it in a button? Flex:修改嵌入式图标并在按钮中使用它?
Hope it helps! 希望能帮助到你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.