/*▶↑圖片預覽框的滑鼠事件*/ private void btn_save_Click(object sender, EventArgs e) //▶儲存,下一張圖片 { ImageCrop.clear(YT_Label, YB_Label, XL_Label, XR_Label); BlockerUtils.setBlockerVisibility(Blocker_Upper, Blocker_Lower, Blocker_Left, Blocker_Right, false); //遮擋塊不可見 ImageCrop.recoverXY(); //將縮放後的座標回復為影像座標 Dirs.thisDirDisplayStr += //用來顯示的文字 "(" + ImageCrop.xL + "," + ImageCrop.yT + ") , (" + ImageCrop.xR + "," + ImageCrop.yB + ")\r\n"; Dirs.thisDirBbInfoText += StringUtils.filePathToName(Dirs.thisImg()) + " " + //即將寫入檔案的文字 ImageCrop.xL + " " + ImageCrop.yT + " " + ImageCrop.xR + " " + ImageCrop.yB + "\r\n"; if (Dirs.nextImg() == null) { this.Close(); return; } ; //沒有下一張了,結束程式 ImageList.Text = Dirs.imgFileNameList; //顯示(重製)影像檔案列表 ImageBbList.Text = Dirs.thisDirDisplayStr; //顯示即將寫入檔案的文字 Image thisImg = Image.FromFile(Dirs.thisImg()); //讀取影像 thisImg = ImageUtils.resizeImage(thisImg, pictureBox1.Width, pictureBox1.Height); //縮放至適合大小 pictureBox1.Image = thisImg; //顯示影像 }
private void pictureBox1_MouseMove(object sender, MouseEventArgs e) { if (!isMouseDown) { return; } ImageCrop.dig(e.X, e.Y); ImageCrop.setLabelText(YT_Label, YB_Label, XL_Label, XR_Label); //邊界顯示文字(上下左右) BlockerUtils.setBlockerPosition(Blocker_Upper, Blocker_Lower, Blocker_Left, Blocker_Right, pictureBox1); //遮擋塊位置 }
private void btn_again_Click(object sender, EventArgs e) //▶重來,清空 { ImageCrop.clear(YT_Label, YB_Label, XL_Label, XR_Label); BlockerUtils.setBlockerVisibility(Blocker_Upper, Blocker_Lower, Blocker_Left, Blocker_Right, false); //遮擋塊不可見 }