在WF4.0中修改自定义Activity的Icon

    "Icon" is a property on the main <sap:ActivityDesigner> element of the designer and it's of type "DrawingBrush". 

    If you want to set an image (BMP, JPG...) as the Icon, just add this XAML exactly after the starting element of the designer: 
复制代码
代码
<sap:ActivityDesigner.Icon> 

        
<DrawingBrush>
            
<DrawingBrush.Drawing>
                
<ImageDrawing>
                    
<ImageDrawing.Rect>
                        
<Rect Location="0,0" Size="16,16" ></Rect>
                    
</ImageDrawing.Rect>
                    
<ImageDrawing.ImageSource>
                        
<BitmapImage UriSource="D:\Public\Foto\IMG_2560.JPG" ></BitmapImage>
                    
</ImageDrawing.ImageSource>
                
</ImageDrawing>
            
</DrawingBrush.Drawing>
        
</DrawingBrush>
    
</sap:ActivityDesigner.Icon>
复制代码

     Obviously, change the UriSource to match your Icon/Bitmap. If you want to apply a WPF DrawingBrush, design the Icon with Expression Designer and copy/paste XAML/ResourceDicrionary and use it.
    If you want to set a vectorial drawing, like I do:

复制代码
代码
<sap:ActivityDesigner.Icon>
        
<DrawingBrush>
                
<DrawingBrush.Drawing>
                    
<DrawingGroup>
                        
<DrawingGroup.Children>
                            
<GeometryDrawing Geometry="F1 M 35,-124C 45.2172,-124 53.5,-115.717 53.5,-105.5C 53.5,-95.2827 45.2173,-86.9999 35,-86.9999C 24.7827,-86.9999 16.5,-95.2827 16.5,-105.5C 16.5,-115.717 24.7828,-124 35,-124 Z ">
                                
<GeometryDrawing.Pen>
                                    
<Pen Thickness="0.32" LineJoin="Round" Brush="#57008898"/>
                                
</GeometryDrawing.Pen>
                                
<GeometryDrawing.Brush>
                                    
<RadialGradientBrush RadiusX="0.5" RadiusY="0.5" Center="0.71625,0.283751" GradientOrigin="0.71625,0.283751">
                                        
<RadialGradientBrush.GradientStops>
                                            
<GradientStop Color="#57FFFFFF" Offset="0.0104712"/>
                                            
<GradientStop Color="#5712C5DB" Offset="0.65445"/>
                                            
<GradientStop Color="#5714C5DB" Offset="0.654727"/>
                                            
<GradientStop Color="#5717C6DB" Offset="0.905759"/>
                                            
<GradientStop Color="#5711A5B7" Offset="1"/>
                                        
</RadialGradientBrush.GradientStops>
                                        
<RadialGradientBrush.RelativeTransform>
                                            
<TransformGroup/>
                                        
</RadialGradientBrush.RelativeTransform>
                                    
</RadialGradientBrush>
                                
</GeometryDrawing.Brush>
                            
</GeometryDrawing>
                        
</DrawingGroup.Children>
                    
</DrawingGroup>
                
</DrawingBrush.Drawing>
        
</DrawingBrush>
    
</sap:ActivityDesigner.Icon>
复制代码

 



(全文完)


以下为广告部分

您部署的HTTPS网站安全吗?

如果您想看下您的网站HTTPS部署的是否安全,花1分钟时间来 myssl.com 检测以下吧。让您的HTTPS网站变得更安全!

SSL检测评估

快速了解HTTPS网站安全情况。

安全评级(A+、A、A-...)、行业合规检测、证书信息查看、证书链信息以及补完、服务器套件信息、证书兼容性检测等。

SSL证书工具

安装部署SSL证书变得更方便。

SSL证书内容查看、SSL证书格式转换、CSR在线生成、SSL私钥加解密、CAA检测等。

SSL漏洞检测

让服务器远离SSL证书漏洞侵扰

TLS ROBOT漏洞检测、心血漏洞检测、FREAK Attack漏洞检测、SSL Poodle漏洞检测、CCS注入漏洞检测。

posted @   麒麟  阅读(2093)  评论(1编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· [AI/GPT/综述] AI Agent的设计模式综述
点击右上角即可分享
微信分享提示