共用方式為


DtsTaskAttribute.IconResource Property

Definition

Gets or sets the icon associated with the task object.

public:
 property System::String ^ IconResource { System::String ^ get(); void set(System::String ^ value); };
public string IconResource { get; set; }
member this.IconResource : string with get, set
Public Property IconResource As String

Property Value

A string that identifies the icon resource of the task.

Examples

The following example shows a task class that provides an icon resource. In this example, the icon file is named MyTaskIcon.ico, and the assembly name is MyTask.

using System;  
using Microsoft.SqlServer.Dts.Runtime;  
namespace Microsoft.SSIS.Samples  
{  
  [DtsTask  
  (  
   DisplayName = "MyTask",  
   IconResource = "MyTask.MyTaskIcon.ico",  
   UITypeName = "My Custom Task," +  
   "Version=1.0.0.0," +  
   "Culture = Neutral," +  
   "PublicKeyToken = 12345abc6789de01",  
   TaskType = "PackageMaintenance",  
   TaskContact = "MyTask; company name; any other information",  
   RequiredProductLevel = DTSProductLevel.None  
   )]  
  public class MyTask : Task  
  {  
    // Your code here.  
  }  
}  
Imports System  
Imports Microsoft.SqlServer.Dts.Runtime  

<DtsTask(DisplayName:="MyTask", _  
 IconResource:="MyTask.MyTaskIcon.ico", _  
 UITypeName:="My Custom Task," & _  
 "Version=1.0.0.0,Culture=Neutral," & _  
 "PublicKeyToken=12345abc6789de01", _  
 TaskType:="PackageMaintenance", _  
 TaskContact:="MyTask; company name; any other information", _  
 RequiredProductLevel:=DTSProductLevel.None)> _  
Public Class MyTask  
  Inherits Task  

  ' Your code here.  

End Class 'MyTask  

Remarks

When specified, this property identifies the icons that are shown in the Control Flow Items Toolbox and on the package Control Flow designer surface when the task is added to a package.

The Control Flow Items Toolbox uses the 16x16, 16 colors image type and the data flow designer surface uses the 32x32, 16 colors image type that are the default image types of icons created using Visual Studio .NET.

The format of the string that identifies the icon resource is a dotted notation that consists of the name of the assembly and the name of the icon file, separated by a period (.).

To embed an icon file as a resource in an assembly using Visual Studio .NET, create a new icon, and then set the icon file's Build Action attribute to Embedded Resource in the Visual Studio Properties window.

Applies to