1.画ROI
#region ROI设定
//画矩形框
Point start;
Point end;
bool blnDraw; //在MouseMove事件中判断是否绘制矩形框
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
start = e.Location;
blnDraw = true;
}
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (blnDraw)
{
if (e.Button != MouseButtons.Left)
return;
end = e.Location;
pictureBox1.Invalidate();
}
}
private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{
PictureBox pic = sender as PictureBox;
if (e.Button == MouseButtons.Left)
{
end = e.Location;
blnDraw = false;
}
if (e.Button == MouseButtons.Right)
{
}
}
relet