在图像上画线,m和n 为铅笔图片与左上角偏差。
Graphics g = Graphics.FromImage(pictureBox_main.Image);
g.DrawLine(new Pen(Color.Black, ImageEditLineWidth),new Point(ImageEditStartPoint.X+m,ImageEditStartPoint.Y+n), new Point(e.X+m, e.Y+n));
pictureBox_main.Refresh();
g.Dispose();
自定义光标,用cur文件替换光标图像。
string pencilPath = Application.StartupPath + @"\img\pa.cur";
if (File.Exists(pencilPath))
pictureBox_main.Cursor = new Cursor(pencilPath);
else
pictureBox_main.Cursor = Cursors.IBeam;