ActivityDesigner.Initialize(Activity) ActivityDesigner.Initialize(Activity) ActivityDesigner.Initialize(Activity) Method

定義

使用相關聯的 Activity 初始化設計工具。Initializes the designer with the associated Activity.

protected:
 virtual void Initialize(System::Workflow::ComponentModel::Activity ^ activity);
protected virtual void Initialize (System.Workflow.ComponentModel.Activity activity);
abstract member Initialize : System.Workflow.ComponentModel.Activity -> unit
override this.Initialize : System.Workflow.ComponentModel.Activity -> unit

參數

activity
Activity Activity Activity

要用來初始化設計工具的 ActivityThe Activity with which the designer should be initialized.

範例

下列範例示範如何覆寫 Initialize 方法的基底類別實作。The following example shows how to override the base class implementation of the Initialize method. 這個範例中的 Initialize 方法會從內嵌資源載入 Bitmap 物件。The Initialize method in this example is loading a Bitmap object from an embedded resource. ToolboxImage 資源就是基底 Image 類別繪製自訂 ActivityDesigner 時所使用的 ActivityDesignerThe ToolboxImage resource is the Image that is used when the base ActivityDesigner class draws the custom ActivityDesigner.

protected override void Initialize(Activity activity)
{
    base.Initialize(activity);
    Bitmap bmp = Resources.ToolboxImage;
    bmp.MakeTransparent();
    this.Image = bmp;
}
Protected Overrides Sub Initialize(ByVal activity As Activity)

    MyBase.Initialize(activity)
    Dim bmp As Bitmap = Resources.ToolboxImage
    bmp.MakeTransparent()
    Me.Image = bmp
End Sub

備註

Initialize 會使用指定的 Activity 載入設計工具。Initialize loads the designer with the Activity specified. 設計工具會載入 Activity 服務、更新與活動相關聯的動詞,以及指派預設文字和影像到設計工具中。The designer loads the Activity service, updates the verbs associated with the activity and assigns the default text and image to the designer.

適用於