C#画笔Pen保存和恢复图形对象的设置方法
程序员文章站
2023-11-17 19:51:04
本文实例讲述了c#画笔pen保存和恢复图形对象的设置方法。分享给大家供大家参考。具体如下:
using system;
using system.collect...
本文实例讲述了c#画笔pen保存和恢复图形对象的设置方法。分享给大家供大家参考。具体如下:
using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.text; using system.windows.forms; using system.drawing.drawing2d; namespace windowsapplication2 { public partial class form11 : form { public form11() { initializecomponent(); } private void button1_click(object sender, eventargs e) { lineargradientbrush brush = new lineargradientbrush(this.clientrectangle, color.empty, color.empty, 100); colorblend blend = new colorblend(); blend.colors = new color[] { color.red, color.green, color.blue }; blend.positions = new float[] { 0, .5f, 1 }; brush.interpolationcolors = blend; pen pen5 = new pen(brush); graphics g5 = this.creategraphics(); point[] p = new point[] { new point(0, 0), new point(100, 100), new point(50, 100), new point(200, 100) }; graphicsstate old = g5.save(); g5.smoothingmode = smoothingmode.antialias; g5.restore(old); g5.drawcurve(pen5,p); } } }
希望本文所述对大家的c#程序设计有所帮助。
上一篇: 深入浅出RxJava+Retrofit+OkHttp网络请求
下一篇: java文件名判断练习