我正在尝试在图像的位图上的特定区域周围绘制蓝色矩形。但出现错误EventArg没有图形
private void SaveBtn_Click(object sender, EventArgs e)
{
// asking the user for the location and name the user wants for this file
SaveFileDialog dialog = new SaveFileDialog();
// getting the file type options
dialog.Filter = "Bitmap Image (.bmp)|*.bmp|Gif Image (.gif)|*.gif |JPEG Image (.jpeg)|*.jpeg |Png Image (.png)|*.png";
// getting the currecntFrame from the Video Source Player control
Bitmap currentFrame = videoSourcePlayer.GetCurrentVideoFrame();
// Create graphics object for alteration.
Graphics newGraphics = Graphics.FromImage(currentFrame);
// Alter image.
newGraphics.DrawRectangle(Pens.AliceBlue, _stIR.X, _stIR.Y, _endIR.X - _stIR.X, _endIR.Y - _stIR.Y);
// Draw image to screen.
e.Graphics.DrawImage(currentFrame, new PointF(0.0F, 0.0F));
// Dispose of graphics object.
newGraphics.Dispose();
// if the user click ok
if (dialog.ShowDialog() == DialogResult.OK)
{
// save the pictures
currentFrame.Save(dialog.FileName, ImageFormat.Png);
}
}
我希望能够在我拥有的图像上方的某个区域周围保存一个蓝色矩形。因此,它就是图像和图像内部某处周围的蓝色矩形。