How to change the shape of a button

I want to know how can I make a button circle shape in C #? thank

+3
source share
4 answers

Look at something like this

Custom button with color and shape

0
source

If you use WPF, then this is quite simple.

If you use WinForms, this is more difficult, since you need to override the button drawing method, but still possible.

0
source
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace shapes
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

            GraphicsPath gp = new GraphicsPath();
            gp.AddEllipse(0, 0, 100, 100);
            this.Region = new Region(gp);
        }
    }
}
0
source

I successfully made circular custom buttons using a PictureBox and using the Click (or MouseClick) action on it:

0
source

Source: https://habr.com/ru/post/1735192/


All Articles