我有一张尺寸为100x50的图片,我想在中间画一个点-即50x25。我该怎么做?
最佳答案
Graphics g = pictureBox1.CreateGraphics();
g.DrawEllipse(Pens.Black, new Rectangle(50, 25, 1, 1));
寻找here保存图片
它不会占用表单负载,因此您应该将代码添加到表单
paint
event中:private void Form1_Paint(object sender, PaintEventArgs e)
{
Application.DoEvents();
Graphics g = pictureBox1.CreateGraphics();
g.DrawEllipse(Pens.DarkBlue, new Rectangle(120, 90, 1, 1));
}