Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/11/2013, 08:20
maria_dp
 
Fecha de Ingreso: noviembre-2013
Mensajes: 2
Antigüedad: 10 años, 5 meses
Puntos: 0
Guardar imagen seleccionada dentro de un PictureBox - C++ forms

Hola,
he conseguido seleccionar un área dentro de un PictureBox, pero necesito guardar ese área seleccionada como una imagen .jpg en una ruta que yo le pase.

El código que he usado para seleccionar ese área es el siguiente:

System::Void picturebox_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
if (e->Button == System::Windows::Forms::MouseButtons::Left)
{
pos = e->Location;
}
}


System::Void picturebox_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e)
{
// Draw the rectangle...
float PenWidth = 5;
e->Graphics->DrawRectangle( gcnew Pen( Color::White,PenWidth ), RcDraw );
}

System::Void picturebox_MouseMove(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
if (e->Button == System::Windows::Forms::MouseButtons::Left)
{
RcDraw.Width = e->X - pos.X;
RcDraw.Height = e->Y - pos.Y;

if (RcDraw.Width < 0)
{
RcDraw.Width *= -1;
RcDraw.X = pos.X - RcDraw.Width;
}
else
{
RcDraw.X = pos.X;
}

if (RcDraw.Height < 0)
{
RcDraw.Height *= -1;
RcDraw.Y = pos.Y - RcDraw.Height;
}
else
{
RcDraw.Y = pos.Y;
}

picturebox->Invalidate();
}
}


si alguien me puede ayudar se lo agradecería.