ControlDesigner.OnPaint(PaintEventArgs) Método

Definição

Chamado quando o designer de controle desenha o controle associado na superfície de design, se o valor CustomPaint for true.Called when the control designer draws the associated control on the design surface, if the CustomPaint value is true.

protected:
 virtual void OnPaint(System::Windows::Forms::PaintEventArgs ^ e);
protected virtual void OnPaint (System.Windows.Forms.PaintEventArgs e);
abstract member OnPaint : System.Windows.Forms.PaintEventArgs -> unit
override this.OnPaint : System.Windows.Forms.PaintEventArgs -> unit
Protected Overridable Sub OnPaint (e As PaintEventArgs)

Parâmetros

e
PaintEventArgs

Um objeto PaintEventArgs que especifica os limites de gráficos e retângulo usados para desenhar o controle.A PaintEventArgs object that specifies the graphics and rectangle boundaries used to draw the control.

Comentários

O ViewEvent evento é gerado pelo host de design para determinadas ações em um controle na superfície de design.The ViewEvent event is raised by the design host for certain actions on a control in the design surface. Por exemplo, um evento é gerado para as seguintes condições:For example, an event is raised for the following conditions:

  • O usuário clica no controle.The user clicks the control.

  • O host de design solicita marcação HTML para renderizar o controle associado na superfície de design.The design host requests HTML markup to render the associated control on the design surface.

  • O usuário insere ou sai do modo de edição do modelo para o controle.The user enters or exits template editing mode for the control.

A ControlDesigner classe fornece um delegado padrão para manipular o IControlDesignerView.ViewEvent evento.The ControlDesigner class supplies a default delegate to handle the IControlDesignerView.ViewEvent event. Classes derivadas de ControlDesigner devem definir o ViewFlags.CustomPaint valor e substituir o OnPaint método para processar eventos que são gerados quando o host de design desenha o controle na superfície de design.Classes deriving from ControlDesigner should set the ViewFlags.CustomPaint value and override the OnPaint method to process events that are raised when the design host draws the control on the design surface.

O OnPaint método permite que classes derivadas manipulem o evento sem anexar um delegado.The OnPaint method allows derived classes to handle the event without attaching a delegate. Essa é a técnica preferida para manipular o evento em uma classe derivada.This is the preferred technique for handling the event in a derived class.

A implementação padrão do OnPaint método retorna sem executar nenhum processamento.The default implementation of the OnPaint method returns without performing any processing.

Notas aos Herdeiros

Substitua o OnPaint(PaintEventArgs) método em uma classe derivada da ControlDesigner classe para manipular eventos de pintura para um controle na superfície de design.Override the OnPaint(PaintEventArgs) method in a class deriving from the ControlDesigner class to handle paint events for a control in the design surface. No entanto, o evento só ocorrerá se o CustomPaint valor tiver sido definido com o SetViewFlags(ViewFlags, Boolean) método.However, the event occurs only if the CustomPaint value has been set with the SetViewFlags(ViewFlags, Boolean) method.

Aplica-se a

Confira também