InvalidateEventArgs 类

定义

Invalidated 事件提供数据。Provides data for the Invalidated event.

public ref class InvalidateEventArgs : EventArgs
public class InvalidateEventArgs : EventArgs
type InvalidateEventArgs = class
    inherit EventArgs
Public Class InvalidateEventArgs
Inherits EventArgs
继承
InvalidateEventArgs

示例

下面的代码示例演示如何使用此类型。The following code example demonstrates the use of this type. 在此示例中, 事件处理程序报告Invalidated事件的发生。In the example, an event handler reports on the occurrence of the Invalidated event. 此报表可帮助你了解何时发生事件, 并可帮助你进行调试。This report helps you to learn when the event occurs and can assist you in debugging. 若要报告多个事件或频繁发生的事件, 请考虑ShowConsole.WriteLine消息替换为多行或将TextBox其追加到多行。To report on multiple events or on events that occur frequently, consider replacing Show with Console.WriteLine or appending the message to a multiline TextBox.

若要运行示例代码, 请将其粘贴到一个项目中, 该项目包含从Control继承的类型的实例, 如ComboBox Button或。To run the example code, paste it into a project that contains an instance of a type that inherits from Control, such as a Button or ComboBox. 然后命名该实例Control1 , 并确保事件处理程序Invalidated与事件相关联。Then name the instance Control1 and ensure that the event handler is associated with the Invalidated event.

private void Control1_Invalidated(Object sender, InvalidateEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "InvalidRect", e.InvalidRect );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "Invalidated Event" );
}
Private Sub Control1_Invalidated(sender as Object, e as InvalidateEventArgs) _ 
     Handles Control1.Invalidated

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "InvalidRect", e.InvalidRect)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"Invalidated Event")

End Sub

注解

更新Invalidated控件的显示时发生该事件。The Invalidated event occurs when a control's display is updated. InvalidateEventArgs指定包含无效窗口区域的矩形。An InvalidateEventArgs specifies the rectangle that contains the invalidated window area.

有关事件模型的信息, 请参阅处理和引发事件For information about the event model, see Handling and Raising Events.

构造函数

InvalidateEventArgs(Rectangle)

初始化 InvalidateEventArgs 类的新实例。Initializes a new instance of the InvalidateEventArgs class.

属性

InvalidRect

获取 Rectangle,它包含无效窗口区域。Gets the Rectangle that contains the invalidated window area.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅