public static void
load_Photo_compressed_to_Clipboard(string input_Image_Path, int
setLength)
{
//---------------< Image_resize() >---------------
Bitmap source_Bitmap = new
Bitmap(input_Image_Path);
double dblWidth_origial =
source_Bitmap.Width;
double dblHeigth_origial
= source_Bitmap.Height;
//< check orientation >
bool
IsOrientation_Horizontal = (dblWidth_origial > dblHeigth_origial) ? true : false;
//</ check orientation >
int new_Height = 0;
int new_Width = 0;
double zoom_factor = 1;
if (IsOrientation_Horizontal == true)
{
new_Width = setLength;
zoom_factor = new_Width /
dblWidth_origial;
new_Height = (int)(dblHeigth_origial
* zoom_factor);
}
else
{
new_Height = setLength;
zoom_factor = new_Height /
dblHeigth_origial;
new_Width = (int)(dblWidth_origial
* zoom_factor);
}
Image outImage = new Bitmap(source_Bitmap,
new_Width, new_Height);
var t = new
Thread((ThreadStart)(() =>
{
Clipboard.SetImage(outImage);
}));
t.SetApartmentState(ApartmentState.STA);
t.Start();
t.Join();
//---------------</ Image_resize() >---------------
}
|