Nasıl yapılır: Şekilli Windows Formu Oluşturma
Bu örnek, forma formla birlikte yeniden boyutlandıran eliptik bir şekil verir.
Örnek
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
Kod Derleniyor
Bu örnek şunları gerektirir:
- ve ad System.Windows.FormsSystem.Drawing alanlarına başvurular.
Bu örnek, OnPaint formun şeklini değiştirmek için yöntemini geçersiz kılar. Bu kodu kullanmak için yöntem bildirimini ve yönteminin içindeki çizim kodunu kopyalayın.