Ejemplo n.º 1
0
        /*▶↑圖片預覽框的滑鼠事件*/

        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;                                                                //顯示影像
        }
Ejemplo n.º 2
0
 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); //遮擋塊位置
 }
Ejemplo n.º 3
0
        public MainWndForm()          //▶Constructor
        {
            InitializeComponent();
            pictureBox1.MouseDown += new MouseEventHandler(pictureBox1_MouseDown);
            pictureBox1.MouseMove += new MouseEventHandler(pictureBox1_MouseMove);
            pictureBox1.MouseUp   += new MouseEventHandler(pictureBox1_MouseUp);

            //這樣設定(Parent關係),透明度才會有作用
            Blocker_Upper.Parent = Blocker_Lower.Parent = Blocker_Left.Parent = Blocker_Right.Parent = pictureBox1;

            Blocker_Upper.BackColor = Blocker_Lower.BackColor = Blocker_Left.BackColor
                                                                    = Blocker_Right.BackColor = Color.FromArgb(160, Color.DarkCyan);

            BlockerUtils.setBlockerVisibility(Blocker_Upper, Blocker_Lower, Blocker_Left, Blocker_Right, false);             //遮擋塊不可見
        }
Ejemplo n.º 4
0
 private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
 {
     isMouseDown = true;
     pictureBox1_MouseMove(sender, e);
     BlockerUtils.setBlockerVisibility(Blocker_Upper, Blocker_Lower, Blocker_Left, Blocker_Right, true);             //遮擋塊可見
 }
Ejemplo n.º 5
0
 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);             //遮擋塊不可見
 }