Drag box around

  • Thread starter Thread starter Btb4198
  • Start date Start date
B

Btb4198

Guest
oh I can make multiple blue boxes on my video player, but I want to make a handle tool that can grab the boxes and more it around. but I am not sure how to.

here is my code :


private void videoSourcePlayer_Paint(object sender, PaintEventArgs e)
{
if (MouseDown == true)
{
e.Graphics.DrawRectangle(Pens.Aqua, new Rectangle(_stIR.X, _stIR.Y, _endIR.X - _stIR.X, _endIR.Y - _stIR.Y));
}

for (int i = 0; i < endIRList.Count; i++)
{
e.Graphics.DrawRectangle(Pens.Aqua, new Rectangle(stIRList.X, stIRList.Y, endIRList.X - stIRList.X, endIRList.Y - stIRList.Y));
}

}



}


private void videoSourcePlayer_MouseDown(object sender, MouseEventArgs e)
{


if (e.Button == MouseButtons.Left)
{
_stIR = e.Location;

MouseDown = true;
}

}


private void videoSourcePlayer_MouseMove(object sender, MouseEventArgs e)
{


if (e.Button == MouseButtons.Left)
{
_endIR = e.Location;
MouseDown = true;
}
}



private void videoSourcePlayer_MouseUp(object sender, MouseEventArgs e)
{


if (e.Button == MouseButtons.Left)
{
_endIR = e.Location;
stIRList.Add(_stIR);
endIRList.Add(_endIR);
Xum1TXT.Text = Convert.ToString(Math.Abs(_endIR.X - _stIR.X) / this.videoSourcePlayer.zoomFactor);
Yum1TXT.Text = Convert.ToString(Math.Abs(_endIR.Y - _stIR.Y) / this.videoSourcePlayer.zoomFactor);

MouseDown = false;
}

}

Continue reading...
 
Back
Top