-1
我想用类,而不是XAML风格如何使用
此代码工作的WinForms应用创建圆形按钮类,我怎样才能将其转换为WPF代码创建WPF圆角按钮?
public class RoundButton : Button
{
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
GraphicsPath grPath = new GraphicsPath();
grPath.AddEllipse(0, 0, ClientSize.Width, ClientSize.Height);
this.Region = new System.Drawing.Region(grPath);
base.OnPaint(e);
}
}
难道那种打败XAML的整个目的?如果你使用的是WPF,你应该做[类似于这个](https://stackoverflow.com/questions/2601604/wpf-user-control-round-corners-programmatically)。 – Sach