close
C# 視窗程式範例--繪製圖形並存檔
using System.Text;
using System.Windows.Forms;
namespace test3
{
public partial class Form1 : Form
{
private string strName = "D:/testout.bmp";
public Form1()
{
InitializeComponent();
Bitmap Bee = new Bitmap(200, 200);
Graphics K = Graphics.FromImage(Bee);
Pen pen = new Pen(Color.Yellow, 1);
Point startPoint = new Point(1, 1);
Point endPoint = new Point(100, 100);
K.DrawLine(pen, startPoint, endPoint);
pictureBox.Image = Bee;
// K.Dispose();
Bee.Save(strName, System.Drawing.Imaging.ImageFormat.Bmp);
}
}
}
參考文獻
- Saving a Graphic as BMP — http://www.xtremedotnettalk.com/showthread.php?t=72975
文章來源:陳鍾誠 (2011年12月12日),(網頁標題) 繪製圖形並存檔,(網站標題) 免費電子書:C# 程式設計,2011年12月12日,取自 http://cs0.wikidot.com/bitmapgraphics ,網頁修改第 3 版。
文章標籤
全站熱搜