using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
Using System. The Threading. The Tasks;
using System.Windows.Forms;
Using System. Drawing. Drawing2D;
The namespace CustomerUI
{
Public partial class RundEckelButton: the Button
{
Private int the radius;//radius
[CategoryAttribute (" layout "), the BrowsableAttribute (true), ReadOnlyAttribute (false)]
Public int the Radius
{
Set
{
The radius=value;
}
The get
{
Return the radius.
}
}
Protected override void OnPaint (PaintEventArgs e)
{
Base. OnPaintBackground (e);
GraphicsPath path=new GraphicsPath ();
Path. AddArc (0, 0, the radius, the radius, 180 f, 90 f).
Path. AddArc (enclosing Width - the radius - 1, 0, the radius, the radius, 270 f, 90 f).
Path. AddArc (enclosing Width - the radius - 1, enclosing radius, Height - 1, the radius, the radius, 0 f, 90 f).
Path. AddArc (0, enclosing radius, Height - 1, the radius, the radius, 90 f, 90 f).
Path. CloseFigure ();
Enclosing Region=new System. Drawing. The Region (path);
}
Public RundEckelButton ()
{
The radius=10;
Enclosing FlatStyle=FlatStyle;
Enclosing FlatAppearance. BorderSize=1;
}
Private void RundEckelButton_Load (object sender, EventArgs e)
{
}
}
}
CodePudding user response:
Text is need you to paint himself, you after the drawing finished the rounded shapes, text, drawGraphics. DrawString method,