C#畫筆Pen保存和恢復(fù)圖形對象的設(shè)置方法
更新時間:2015年06月12日 09:13:03 作者:zhuzhao
這篇文章主要介紹了C#畫筆Pen保存和恢復(fù)圖形對象的設(shè)置方法,實(shí)例分析了畫筆的保存save及恢復(fù)屬性Restore的相關(guān)使用技巧,需要的朋友可以參考下
本文實(shí)例講述了C#畫筆Pen保存和恢復(fù)圖形對象的設(shè)置方法。分享給大家供大家參考。具體如下:
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#程序設(shè)計(jì)有所幫助。
您可能感興趣的文章:
- 深入C# winform清除由GDI繪制出來的所有線條或圖形的解決方法
- C#實(shí)現(xiàn)判斷圖形文件格式的方法
- c#圖片處理之圖片裁剪成不規(guī)則圖形
- C#實(shí)現(xiàn)在圖像中繪制文字圖形的方法
- C#利用GDI繪制常見圖形和文字
- C#使用Region對圖形區(qū)域構(gòu)造和填充的方法
- C#畫筆Pen使用路徑繪制圖形的方法
- C#圖形區(qū)域剪切的實(shí)現(xiàn)方法
- C#實(shí)現(xiàn)圖形區(qū)域組合操作的方法
- 使用C#編寫簡單的圖形化的可發(fā)送附件的郵件客戶端程序
- C#編程調(diào)用Cards.dll實(shí)現(xiàn)圖形化發(fā)牌功能示例
相關(guān)文章
C#基于QRCode實(shí)現(xiàn)動態(tài)生成自定義二維碼圖片功能示例
這篇文章主要介紹了C#基于QRCode實(shí)現(xiàn)動態(tài)生成自定義二維碼圖片功能,結(jié)合實(shí)例形式分析了C#使用QRCode動態(tài)生成二維碼圖片相關(guān)操作技巧,需要的朋友可以參考下2019-02-02關(guān)于javascript冒泡與默認(rèn)事件的使用詳解
本篇文章是對javascript中冒泡與默認(rèn)事件的使用進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-05-05C#中List轉(zhuǎn)IList的實(shí)現(xiàn)
本文主要介紹了C#中List轉(zhuǎn)IList的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-07-07C#簡單讀取、改變文件的創(chuàng)建、修改及訪問時間的方法
這篇文章主要介紹了C#簡單讀取、改變文件的創(chuàng)建、修改及訪問時間的方法,涉及C#文件類SetCreationTime、SetLastWriteTime及SetLastAccessTime的相關(guān)使用技巧,需要的朋友可以參考下2015-07-07