共用方式為


ToolStripItemImageRenderEventArgs.ImageRectangle 屬性

定義

取得表示影像周圍區域的矩形。

public:
 property System::Drawing::Rectangle ImageRectangle { System::Drawing::Rectangle get(); };
public System.Drawing.Rectangle ImageRectangle { get; }
member this.ImageRectangle : System.Drawing.Rectangle
Public ReadOnly Property ImageRectangle As Rectangle

屬性值

Rectangle,表示影像的周圍區域。

範例

下列程式碼範例示範如何使用這個成員。 在此範例中,事件處理常式會報告事件的發生次數 ToolStripRenderer.RenderItemImage 。 此報告可協助您瞭解事件發生的時間,並可協助您進行偵錯。

若要執行範例程式碼,請將它貼入包含繼承自 ToolStripRenderer 之型別實例的專案,例如 ToolStripSystemRendererToolStripProfessionalRenderer 。 然後命名 實例 ToolStripRenderer1 ,並確定事件處理常式與 事件相關聯 ToolStripRenderer.RenderItemImage

private void ToolStripRenderer1_RenderItemImage(Object sender, ToolStripItemImageRenderEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Image", e.Image );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ImageRectangle", e.ImageRectangle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Item", e.Item );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ToolStrip", e.ToolStrip );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RenderItemImage Event" );
}
Private Sub ToolStripRenderer1_RenderItemImage(sender as Object, e as ToolStripItemImageRenderEventArgs) _ 
     Handles ToolStripRenderer1.RenderItemImage

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "Image", e.Image)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ImageRectangle", e.ImageRectangle)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Graphics", e.Graphics)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Item", e.Item)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ToolStrip", e.ToolStrip)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"RenderItemImage Event")

End Sub

適用於