ViewEvent 类

定义

表示设计时在控件的视图上发生的事件的类型。Represents the kind of event that has occurred on a view of a control at design time. 此类不能被继承。This class cannot be inherited.

public ref class ViewEvent sealed
public sealed class ViewEvent
type ViewEvent = class
Public NotInheritable Class ViewEvent
继承
ViewEvent

注解

设计ViewEvent宿主向设计器组件提供一个对象, 例如Visual Studio 2005Visual Studio 2005, 引发由控件设计时视图上的某些用户操作导致的事件时。A ViewEvent object is provided to the designer component by the design host, for example Visual Studio 2005Visual Studio 2005, when raising an event caused by certain user actions on the design-time view of a control. IControlDesignerView.ViewEvent事件ViewEventHandler由委托ViewEventArgs方法进行处理, 该方法采用对象作为参数。The IControlDesignerView.ViewEvent event is handled by a ViewEventHandler delegate method, which takes a ViewEventArgs object as a parameter. ViewEventArgs类的ViewEvent属性是一个对象。 EventTypeThe EventType property of the ViewEventArgs class is a ViewEvent object. 委托方法将EventType属性与静态ViewEvent字段进行比较, 以确定引发事件的操作的类型。 ViewEventHandlerThe ViewEventHandler delegate method compares the EventType property to the static ViewEvent fields to determine which type of action raised the event. 例如, 在以下情况下会引发事件:For example, an event is raised under the following circumstances:

  • 单击设计图面上的某个区域。You click a region on the design surface.

  • 设计器在设计图面上绘制控件。The designer draws a control on the design surface.

  • 进入或退出控件的模板编辑模式。You enter or exit template editing mode for a control.

类提供用于处理事件的IControlDesignerView.ViewEvent默认委托。 ControlDesignerThe ControlDesigner class supplies a default delegate to handle the IControlDesignerView.ViewEvent event. 自定义控件设计器OnClickOnPaint重写OnTemplateModeChanged 、和方法, 以便为设计图面上的控件处理这些事件。Custom control designers override the OnClick, OnPaint, and OnTemplateModeChanged methods to process those events for the control on the design surface.

设计器宿主为设计图ViewEventArgs面上的操作类型初始化对象, 然后将该对象传递ViewEventHandler给委托。The designer host initializes a ViewEventArgs object for the type of action on the design surface, and then passes the object to the ViewEventHandler delegate. ViewEventArgs对象EventType的属性指示操作的类型:The EventType property of the ViewEventArgs object indicates which type of action:

EventArgs属性提供特定于操作类型的事件参数。The EventArgs property supplies the event arguments that are specific to the type of action.

字段

Click

指示在设计器区域上单击引发了查看事件。Indicates that a view event was raised for a click on a designer region.

Paint

指示在设计图面上绘制控件引发了查看事件。Indicates that a view event was raised for drawing a control on the design surface.

TemplateModeChanged

指示更改控件设计器的模板模式引发了查看事件。Indicates that a view event was raised for changing the template mode of a control designer.

方法

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()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅