ViewEventHandler 委托

定义

表示将处理 ViewEvent 事件的方法,该事件由实现 IControlDesignerView 接口的可视化设计工具(例如 Visual Studio 2005)引发。Represents the method that will handle the ViewEvent event that is raised by visual design tools, such as Visual Studio 2005, implementing the IControlDesignerView interface. 此类不能被继承。This class cannot be inherited.

public delegate void ViewEventHandler(System::Object ^ sender, ViewEventArgs ^ e);
public delegate void ViewEventHandler(object sender, ViewEventArgs e);
type ViewEventHandler = delegate of obj * ViewEventArgs -> unit
Public Delegate Sub ViewEventHandler(sender As Object, e As ViewEventArgs)

参数

sender
Object

事件源。The source of the event.

e
ViewEventArgs

包含事件数据的 ViewEventArgs 对象。A ViewEventArgs object that contains the event data.

继承
ViewEventHandler

注解

创建 ViewEventHandler 委托时,需要标识将处理该事件的方法。When you create a ViewEventHandler delegate, you identify the method that will handle the event. 若要将事件与事件处理程序关联,请将该委托的一个实例添加到事件中。To associate the event with your event handler, add an instance of the delegate to the event. 除非移除了该委托,否则每当发生该事件时就会调用事件处理程序。The event handler is called whenever the event occurs, unless you remove the delegate. 有关事件处理程序委托的详细信息, 请参阅处理和引发事件For more information about event-handler delegates, see Handling and Raising Events.

ViewEvent事件由设计器宿主为设计图面上的控件上的某些操作引发。The ViewEvent event is raised by the designer host for certain actions on a control on the design surface. ViewEvent事件ViewEventHandler由委托ViewEventArgs方法进行处理, 该方法采用对象作为参数。The ViewEvent event is handled by a ViewEventHandler delegate method, which takes a ViewEventArgs object as a parameter.

通常, 控件设计器类不会直接实现或分配ViewEventHandler委托。Typically, control designer classes do not directly implement or assign a ViewEventHandler delegate. 基类提供ViewEvent事件的默认委托。 ControlDesignerThe ControlDesigner base class supplies a default delegate for the 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. Initialize 方法ViewEvent为委托设置默认事件委托。The Initialize method sets the default event delegate for the ViewEvent delegate.

扩展方法

GetMethodInfo(Delegate)

获取指示指定委托表示的方法的对象。Gets an object that represents the method represented by the specified delegate.

适用于

另请参阅