共用方式為


DesignerGlyph.OnPaint 方法

定義

在衍生類別中覆寫時,請執行任何轉譯活動設計工具介面上圖像時所需的工作。

protected:
 abstract void OnPaint(System::Drawing::Graphics ^ graphics, bool activated, System::Workflow::ComponentModel::Design::AmbientTheme ^ ambientTheme, System::Workflow::ComponentModel::Design::ActivityDesigner ^ designer);
protected abstract void OnPaint (System.Drawing.Graphics graphics, bool activated, System.Workflow.ComponentModel.Design.AmbientTheme ambientTheme, System.Workflow.ComponentModel.Design.ActivityDesigner designer);
abstract member OnPaint : System.Drawing.Graphics * bool * System.Workflow.ComponentModel.Design.AmbientTheme * System.Workflow.ComponentModel.Design.ActivityDesigner -> unit
Protected MustOverride Sub OnPaint (graphics As Graphics, activated As Boolean, ambientTheme As AmbientTheme, designer As ActivityDesigner)

參數

graphics
Graphics

Graphics,可執行填滿與繪製工作。

activated
Boolean

true,表示圖像顯示在設計介面上,否則為 false

ambientTheme
AmbientTheme

用於存取環境屬性 (Ambient Property) 設定的 AmbientTheme

designer
ActivityDesigner

要從中取得關於使用者動作之資訊的 ActivityDesigner

範例

下列程式碼範例示範如何覆寫 OnPaint 方法。 程式碼可自訂在與圖像關聯之活動設計工具上繪製圖像物件的方式。

這個程式碼範例是 DesignerGlyphProvider.cs 檔案中<工作流程監視器 SDK>範例的一部分。 如需詳細資訊,請參閱 工作流程監視器

protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
{
    Bitmap bitmap = Resources.Executing;
    bitmap.MakeTransparent(Color.FromArgb(0, 255, 255));
    if (bitmap != null)
        graphics.DrawImage(bitmap, GetBounds(designer, activated), new Rectangle(Point.Empty, bitmap.Size), GraphicsUnit.Pixel);
}
Protected Overrides Sub OnPaint(ByVal graphics As System.Drawing.Graphics, ByVal activated As Boolean, ByVal ambientTheme As System.Workflow.ComponentModel.Design.AmbientTheme, ByVal designer As System.Workflow.ComponentModel.Design.ActivityDesigner)
    Dim bitmap As Bitmap = AppResources.Executing
    bitmap.MakeTransparent(Color.FromArgb(0, 255, 255))

    If Not bitmap Is Nothing Then
        graphics.DrawImage(bitmap, GetBounds(designer, activated), New Rectangle(Point.Empty, bitmap.Size), GraphicsUnit.Pixel)
    End If
End Sub

備註

OnPaint 會使用 CommentIndicatorPen 繪製註解圖像界限和要填滿的 CommentIndicatorBrush

適用於

另請參閱