Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Drawing.Drawing2D;
- using System.Windows.Forms;
- using System.Linq;
- using System.Text;
- using System.Drawing;
- namespace LearnToCode_v0._0
- {
- public class RoundButton : Button
- {
- protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
- {
- GraphicsPath path = new GraphicsPath();
- path.AddEllipse(0, 0, ClientSize.Width, ClientSize.Height);
- this.Region = new Region(path);
- e.Graphics.DrawEllipse(new Pen(Color.Blue, 1000), new Rectangle(new Point(0, 0), ClientSize));
- e.Graphics.FillEllipse(new SolidBrush(BackColor), new Rectangle(new Point(0, 0), ClientSize));
- e.Graphics.DrawString(Text, Font, new SolidBrush(ForeColor), new Rectangle(new Point(0, 0), ClientSize), new StringFormat() {
- LineAlignment = StringAlignment.Center,
- Alignment = StringAlignment.Center
- });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement