public C_web呼叫javaScript(C_edit_img m) { this.M = m; }
/// <summary> /// /// </summary> public void fun_確認儲存(String type) { if (int_拖曳模式 == 拖曳模式.none) { return; } var t = rg_遮罩.Rect; if ((int)(t.Width) == 0 || (int)(t.Height) == 0) { return; } /*System.Drawing.Bitmap img = KiCut(bimg, (int)(t.Left* d_解析度比例_x), (int)(t.Top* d_解析度比例_y), * (int)(t.Width* d_解析度比例_x), (int)(t.Height* d_解析度比例_y));*/ System.Drawing.Bitmap img = KiCut( bimg, (int)(t.Left), (int)(t.Top), (int)(t.Width), (int)(t.Height) ); //避免 寬度 or 高度 未滿50 /*double dd = 60 / t.Width; * if (dd < 60 / t.Height) * dd = 60 / t.Height; * * double d_放大倍率 = 1; * if (dd > d_放大倍率) * d_放大倍率 = dd; * * img = Resize(img, d_放大倍率);*/ if (type == "jpg" || type == "png") { //儲存圖片 String s_儲存路徑 = M.func_取得儲存檔名(type); func_SaveBitmap(img, type, s_儲存路徑);//存檔 //自動存入剪貼簿 try { if (M.checkBox_自動存入剪貼簿.IsChecked.Value) { Clipboard.SetData(DataFormats.Bitmap, img); } } catch { } } else if (type == "edit") { String s_儲存路徑 = M.func_取得儲存檔名(""); var c_edit_img = new C_edit_img(new System.Drawing.Bitmap(img), s_儲存路徑); //如果原視窗是置頂,就讓編輯視窗也置頂 if (M.Topmost) { c_edit_img.TopMost = true; } } else { //存入剪貼簿 try { Clipboard.SetData(DataFormats.Bitmap, img); } catch { } } //清理記憶體 img.Dispose(); img = null; func_關閉程式(); }