แก้ไข

แชร์ผ่าน


ToolStripItemImageRenderEventArgs Class

Definition

Provides data for the RenderItemImage event.

public ref class ToolStripItemImageRenderEventArgs : System::Windows::Forms::ToolStripItemRenderEventArgs
public class ToolStripItemImageRenderEventArgs : System.Windows.Forms.ToolStripItemRenderEventArgs
type ToolStripItemImageRenderEventArgs = class
    inherit ToolStripItemRenderEventArgs
Public Class ToolStripItemImageRenderEventArgs
Inherits ToolStripItemRenderEventArgs
Inheritance
ToolStripItemImageRenderEventArgs

Examples

The following code example demonstrates the use of this type. In the example, an event handler reports on the occurrence of the RenderItemImage event. This report helps you to learn when the event occurs and can assist you in debugging.

To run the example code, paste it into a project that contains an instance of a type that inherits from ToolStripRenderer, such as a ToolStripSystemRenderer or ToolStripProfessionalRenderer. Then name the instance ToolStripRenderer1 and ensure that the event handler is associated with the RenderItemImage event.

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

Constructors

ToolStripItemImageRenderEventArgs(Graphics, ToolStripItem, Image, Rectangle)

Initializes a new instance of the ToolStripItemImageRenderEventArgs class for the specified ToolStripItem that displays an image within the specified space and that has the specified properties.

ToolStripItemImageRenderEventArgs(Graphics, ToolStripItem, Rectangle)

Initializes a new instance of the ToolStripItemImageRenderEventArgs class for the specified ToolStripItem within the specified space and that has the specified properties.

Properties

Graphics

Gets the graphics used to paint the ToolStripItem.

(Inherited from ToolStripItemRenderEventArgs)
Image

Gets the image painted on the ToolStrip.

ImageRectangle

Gets the rectangle that represents the bounding area of the image.

Item

Gets the ToolStripItem to paint.

(Inherited from ToolStripItemRenderEventArgs)
ToolStrip

Gets the value of the Owner property for the ToolStripItem to paint.

(Inherited from ToolStripItemRenderEventArgs)

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to