文章内的代码主要是介绍了如何通过GDI+的方式在WPF中进行画图。
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private System.Drawing.Image bitmap = null;
private MemoryStream mos = null;
private int lastX = -1;
private double lastY = -1;
Thread t = null;
public MainWindow()
{
mos = new MemoryStream();
InitializeComponent();
bitmap = new Bitmap(800,600) ;
t = new Thread(CreateDataAndDraw);
t.IsBackground = true;
t.Start();
this.img.MouseDown += img_MouseDown;
this.img.MouseUp += img_MouseUp;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private System.Drawing.Image bitmap = null;
private MemoryStream mos = null;
private int lastX = -1;
private double lastY = -1;
Thread t = null;
public MainWindow()
{
mos = new MemoryStream();
InitializeComponent();
bitmap = new Bitmap(800,600) ;
t = new Thread(CreateDataAndDraw);
t.IsBackground = true;
t.Start();
this.img.MouseDown += img_MouseDown;
this.img.MouseUp += img_MouseUp;