【发布时间】:2018-06-04 20:16:59
【问题描述】:
如果我问一个愚蠢的问题,请原谅我是编程新手。
我正在尝试显示从实时摄像机获得的实时图像。当我启动程序时,图片框能够显示对象(参见图片1)。当我移除对象时,它会显示此图像(请参阅图片2)。但问题是,当我放回对象时,我应该能够获得与图片 1 相似但看起来像图片 2 的图像。 是不是因为pictureBox没有正常刷新?
//R Mode Tab
private void RModeToolStripMenuItem_Click(object sender, EventArgs e)
{
// There is a method, which will obtain the data value and pass to this drawpix
drawPix(x, y, (int)data, (int)data, (int)data);
pictureBox.Refresh();
// Release camera buffer
camera.Release();
}
private void drawPix(int x, int y, int r, int g, int b)
{
((Bitmap)pictureBox.Image).SetPixel(x, y, Color.FromArgb(r, g, b));
return;
}
在我看来,一旦“黑色”被画到图片框上,它似乎就无法消失了。
【问题讨论】:
标签: c# image winforms picturebox pixel