日期:2014-05-17 浏览次数:21934 次
Bitmap bmp = new Bitmap(this.pictureBox1.ClientRectangle.Width, this.pictureBox1.ClientRectangle.Height);
Graphics g = Graphics.FromImage(bmp);
g.DrawImage(bmp, this.pictureBox1.Location.X, this.pictureBox1.Location.Y);
Color cb = Color.FromArgb(255, 255, 255);
for (int i = 0; i < this.pictureBox1.Width; i++)
{
for (int j = 0; j < this.pictureBox1.Height; j++)
{
bmp.SetPixel(i, j, cb);
}
}
Pen black_pen = new Pen(Color.Black, 3);
Pen think_pen = new Pen(Color.Black, 1);
// g.DrawLine(black_pen, zero_x, zero_y, zero_x + 10, zero_y + 10);
len_cor_x = zero_x + width;
len_cor_y = zero_y + height;
g.DrawLine(black_pen, zero_x, len_cor_y, len_cor_x, len_cor_y);//x坐标轴
//g.DrawLine(black_pen, zero_x, zero_y, zero_x, zero_y + height);//y轴坐标
//g.DrawLine(black_pen, new Point(zero_x, zero_y), new Point(zero_x, zero_y + height));//y轴坐标
g.DrawImage(bmp, this.pictureBox1.Location.X, this.pictureBox1.Location.Y);
this.pictureBox1.Image = bmp;
if (this.pictureBox1.Image == null)
MessageBox.Show("no image");
this.pictureBox1.Invalidate();
g.Dispose();