请问自定义BUTTON有关问题,怎么画一个三角形的BUTTON
请教自定义BUTTON问题,如何画一个三角形的BUTTON
请教如何画将BUTTON画成三角形。
我想采用自定义BUTTON的形式,overwrite onpaint()方法,实现BUTTON的形状改变。
现在不知道代码该怎么实现,请教大家。
------解决方案--------------------
请教如何画将BUTTON画成三角形。
我想采用自定义BUTTON的形式,overwrite onpaint()方法,实现BUTTON的形状改变。
现在不知道代码该怎么实现,请教大家。
------解决方案--------------------
- C# code
this.CreateGraphics().DrawLine(Pens.Black, new Point(100, 100), new Point(200, 200)); this.Refresh(); GraphicsPath gp = new GraphicsPath(); List<PointF> arrPoints = new List<PointF>(); arrPoints.Add(new PointF(0, 0)); arrPoints.Add(new PointF(100, 0)); arrPoints.Add(new PointF(100, 100)); gp.AddLines(arrPoints.ToArray()); gp.CloseFigure(); this.CreateGraphics().DrawPath(Pens.Black, gp); Region r = new Region(gp); button1.Region = r; button1.BackColor = Color.Red;
------解决方案--------------------
- C# code
GraphicsPath gp = new GraphicsPath(); List<PointF> arrPoints = new List<PointF>(); arrPoints.Add(new PointF(0, 0)); arrPoints.Add(new PointF(100, 0)); arrPoints.Add(new PointF(100, 100)); gp.AddLines(arrPoints.ToArray()); gp.CloseFigure(); this.CreateGraphics().DrawPath(Pens.Black, gp); Region r = new Region(gp); button1.Region = r; button1.BackColor = Color.Red;