共用方式為


InkOverlay.Painted 事件

會在 InkOverlay 物件已經完成重新繪製本身時發生。

命名空間:  Microsoft.Ink
組件:  Microsoft.Ink (在 Microsoft.Ink.dll 中)

語法

'宣告
Public Event Painted As InkOverlayPaintedEventHandler
'用途
Dim instance As InkOverlay
Dim handler As InkOverlayPaintedEventHandler

AddHandler instance.Painted, handler
public event InkOverlayPaintedEventHandler Painted
public:
 event InkOverlayPaintedEventHandler^ Painted {
    void add (InkOverlayPaintedEventHandler^ value);
    void remove (InkOverlayPaintedEventHandler^ value);
}
/** @event */
public void add_Painted (InkOverlayPaintedEventHandler value)
/** @event */
public void remove_Painted (InkOverlayPaintedEventHandler value)
JScript 不支援事件。

備註

事件處理常式會收到 PaintEventArgs (英文) 型別的引數,其中包含這個事件的相關資料。

在建立 InkOverlayPaintedEventHandler 委派時,您要識別處理事件的方法。若要使事件與您的事件處理常式產生關聯,請將委派的執行個體加入至事件。除非您移除委派,否則每當事件發生時就會呼叫事件處理常式。基於效能考量,相關事件的預設是關閉的,但會在您加入事件處理常式時自動開啟。

範例

在這個範例中,Painted 事件處理常式是用於在筆墨畫布上繪製浮水印。

Private Sub mInkObject_Painted(ByVal sender As Object, ByVal e As PaintEventArgs)
    Const X As Integer = 12
    Const Y As Integer = 12
    Const COMPANY As String = "Graphic Design Institute"
    Const WEB_SITE As String = "http://www.graphicdesigninstitute.com/"

    Dim cFont As Font = New Font("Arial", 18)
    Dim wFont As Font = New Font("Arial", 9)
    Dim cSize As SizeF = e.Graphics.MeasureString(COMPANY, cFont)

    e.Graphics.DrawString(COMPANY, cFont, Brushes.Wheat, X, Y)
    e.Graphics.DrawString(WEB_SITE, wFont, Brushes.SlateGray, X, cSize.Height + Y)
End Sub
private void mInkObject_Painted(object sender, PaintEventArgs e)
{
    const int X = 12;
    const int Y = 12;
    const string COMPANY = "Graphic Design Institute";
    const string WEB_SITE = "http://www.graphicdesigninstitute.com/";

    Font cFont = new Font("Arial", 18);
    Font wFont = new Font("Arial", 9);
    SizeF cSize = e.Graphics.MeasureString(COMPANY, cFont);

    e.Graphics.DrawString(COMPANY, cFont, Brushes.Wheat, X, Y);
    e.Graphics.DrawString(WEB_SITE, wFont, Brushes.SlateGray, X, cSize.Height + Y);
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

InkOverlay 類別

InkOverlay 成員

Microsoft.Ink 命名空間

InkOverlay.Painting

System.Windows.Forms.PaintEventArgs