Nota:
El acceso a esta página requiere autorización. Puede intentar iniciar sesión o cambiar directorios.
El acceso a esta página requiere autorización. Puede intentar cambiar los directorios.
En este ejemplo, se le da al formulario una forma elíptica que cambia de tamaño con él.
Ejemplo
protected:
virtual void OnPaint(
System::Windows::Forms::PaintEventArgs^ e) override
{
System::Drawing::Drawing2D::GraphicsPath^ shape =
gcnew System::Drawing::Drawing2D::GraphicsPath();
shape->AddEllipse(0, 0, this->Width, this->Height);
this->Region = gcnew System::Drawing::Region(shape);
}
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
System.Drawing.Drawing2D.GraphicsPath shape = new System.Drawing.Drawing2D.GraphicsPath();
shape.AddEllipse(0, 0, this.Width, this.Height);
this.Region = new System.Drawing.Region(shape);
}
Protected Overrides Sub OnPaint( _
ByVal e As System.Windows.Forms.PaintEventArgs)
Dim shape As New System.Drawing.Drawing2D.GraphicsPath
shape.AddEllipse(0, 0, Me.Width, Me.Height)
Me.Region = New System.Drawing.Region(shape)
End Sub
Compilar el código
Este ejemplo requiere:
- Referencias a los espacios de nombres System.Windows.Forms y System.Drawing.
En este ejemplo se invalida el OnPaint método para cambiar la forma del formulario. Para usar este código, copie la declaración del método, así como el código de dibujo dentro del método .
Consulte también
.NET Desktop feedback