简体   繁体   English

如何在 Soley Studio 的图形视图中为节点使用图像而不是形状?

[英]How can I use an image instead of a shape for a node in graph view in Soley Studio?

I am setting up my graph view template in Soley Studio.我正在 Soley Studio 中设置我的图形视图模板。 In some pre-installed solutions I saw that nodes in graph view have been visualized with an icon or graphic instead of a circle, rectangle, etc.在一些预安装的解决方案中,我看到图形视图中的节点已使用图标或图形而不是圆形、矩形等进行可视化。

I want to define my properties for a node class in such way, that it shows a gear icon or something similar.我想以这样的方式为节点类定义我的属性,它显示一个齿轮图标或类似的东西。 Which <property> do I have to use?我必须使用哪个<property>

I copied one from another solution, but it does not change anything:我从另一个解决方案中复制了一个,但它没有改变任何东西:

<Style DataSource=".ProdFunction" VisualTarget=”Node”>
<!-- View Properties --> 
<Properties>
<Property Name="StyleName" Value="ShapeOrImageNodeStyle" />
<Property Name="Image">
<Value IsReference="true">icon</Value>
</Property> 
<Property Name="ColorizeImage" Value = "false" />
<Property Name="Width" Value="60" />
<Property Name="Height" Value="60" /> 
</Properties>
</Style>

I wanted to use <Property Name="Image"> <Value IsReference="true">icon</Value></Property> .我想使用<Property Name="Image"> <Value IsReference="true">icon</Value></Property> But nothing changes.但什么都没有改变。 How do I refer to the “icon” I want to have?我如何引用我想要的“图标”? Adding it to the Images folder did not help.将它添加到 Images 文件夹没有帮助。

With <Property Name="Image"> <Value IsReference="true">icon</Value></Property> you are referring to an attribute icon of your node class ProdFunction .使用<Property Name="Image"> <Value IsReference="true">icon</Value></Property>您指的是节点类ProdFunction的属性icon The value of this attribute would have to be the path to the image you want to use.此属性的值必须是您要使用的图像的路径。 eg images\\gearicon.png (a path from your project on is sufficient)例如images\\gearicon.png (从您的项目开始的路径就足够了)

This way is very useful if you want to have different images/icons visualized for each instance of one class.如果您希望为一个类的每个实例可视化不同的图像/图标,这种方式非常有用。 In your case I would recommend you to simply define one image file for the whole node class.在您的情况下,我建议您为整个节点类简单地定义一个图像文件。 Then you also do not need to define an additional attribute for you ProdFunction class.然后您也不需要为您的ProdFunction类定义额外的属性。

Your graph view template style may look like this in the end:您的图形视图模板样式最终可能如下所示:

<?xml version="1.0" encoding="utf-8" ?>
<View Provider="Soley.Framework.AddIns.GraphDataViewProvider.GraphDataDisplayBinding">
      <References>
        <Reference Source="DataPresentation::ViewTemplates/Graph.slvt"/>
      </References>

    <Styles>
      <Style DataSource=".ProdFunction" VisualTarget=”Node”>

       <Properties>
         <Property Name="StyleName" Value="ShapeOrImageNodeStyle" />

         <Property Name="Image">
           <Value>images\gearicon.png</Value>
         </Property> 

         <Property Name="ColorizeImage" Value = "false" />

         <Property Name="Width" Value="60" />
         <Property Name="Height" Value="60" /> 
      </Properties>  

    </Style>
   </Styles>
</View>

Here is also a list with available view properties in Soley Studio: Help Center - View Templates这里还有一个包含 Soley Studio 中可用视图属性的列表:帮助中心 - 视图模板

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM