C# 自绘式按钮的实例 源码
代码说明:
C# 自绘式按钮的实例源码,本例主要是以复合控件方式创建自绘式按钮,并测试了自绘式按钮响应鼠标单击事件。自绘按钮的绘制,可以参考以下代码: //绘制新按钮 Graphics MyGraphics = e.Graphics; Point[] MyPtsA = { new Point(0, 0), new Point(90, 0), new Point(170, 0), new Point(170, 50), new Point(170, 90), new Point(90, 90), new Point(0, 90), new Point(0, 50) }; Color[] MyColsA = { Color.White, Color.Black, Color.White, Color.Black, Color.White, Color.Black, Color.White, Color.Black }; PathGradientBrush MyPGBrushA = new PathGradientBrush(MyPtsA); MyPGBrushA.SurroundColors = MyColsA; MyGraphics.FillRectangle(MyPGBrushA, 0, 0, 170, 90); String MyText = "自绘式按钮"; Font MyFont = new Font("隶书", 22); SolidBrush MyBrush = new SolidBrush(Color.White); PointF MyPoint = new PointF(3.0F, 30.0F); MyGraphics.DrawString(MyText, MyFont, MyBrush, MyPoint);
下载说明:请别用迅雷下载,失败请重下,重下不扣分!