C# 如何更改按钮的形状
我想知道如何用C#制作按钮形状的圆?C# 如何更改按钮的形状,c#,C#,我想知道如何用C#制作按钮形状的圆? 谢谢看看这样的东西 如果您使用的是WPF,那么这相当简单 如果您使用的是WinForms,那么这就更难了,因为您必须覆盖按钮绘制方法,但仍然有可能。我通过使用并在其上实现单击(或鼠标单击)操作,成功地创建了圆形自定义按钮: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; u
谢谢看看这样的东西
如果您使用的是WPF,那么这相当简单
如果您使用的是WinForms,那么这就更难了,因为您必须覆盖按钮绘制方法,但仍然有可能。我通过使用并在其上实现单击(或鼠标单击)操作,成功地创建了圆形自定义按钮:
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;//add this namespace
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, button1.Width, button1.Height);
button1.Region = new Region(gp);
gp.Dispose();
}
}
}
WPF、WinForms、ASP.NET、什么版本?这是高性能吗?@Marvin如何评估性能?这是高性能吗?