Пример #1
0
 private void finalizeOnScreenRectangle()
 {
     if (Math.Abs(X_begin - X_current) > 35 && Math.Abs(Y_begin - Y_current) > 35)
     {                        // 35px must be the minimum dimension of an Image.
         this.drawOnScreenRectangle(PacientData.getRatio());
         this.drawOkButton(); // draw OK/ACCEPT BUTTON IN BOTTOM-RIGHT OF BIG-RECTANGLE:
     }
     else
     {
         MessageBox.Show("Please make a larger selection!");
     }
 }
Пример #2
0
        private void Draw_Tick(object sender, EventArgs e)
        {
            this.X_current = System.Windows.Forms.Cursor.Position.X;
            this.Y_current = System.Windows.Forms.Cursor.Position.Y;

            // this TimerTick simulate drawing an onScreen-Rectangle in real time
            // to draw on screen use Key ALT + MouseMove, and realease ALT when you're done

            if (Control.ModifierKeys == Keys.Alt)       // Key ALT is pressed (ALT-move & ALT-down)
            {                                           //   (you drawing in real time)
                if (isDrawingRectangle)
                {
                    this.drawOnScreenRectangle(PacientData.getRatio());
                    #region wait time before Clear screen
                    Image img = Image.FromFile(@"In App - Images\Transparent Background - DrawRectagle.png");
                    //img = Image.FromFile(@"In App - Images\Transparent Background - DrawRectagle.png");
                    #endregion
                    graphics.Clear(Color.White);



                    this.TopMost = true;
                }
                else
                {
                    smallRectangleDialog.Close();
                    this.isDrawingRectangle = true;
                    this.X_begin            = this.X_current;
                    this.Y_begin            = this.Y_current;
                }
            }
            else if (Control.ModifierKeys != Keys.Alt && isDrawingRectangle)
            {                                                // Key ALT is UP (you finish drawing rectangle)
                this.isDrawingRectangle = false;
                this.finalizeOnScreenRectangle();
            }

            else if (Control.MouseButtons == MouseButtons.Right)
            {
                X_begin         = MousePosition.X - this.widthRectangle + 7;
                Y_begin         = MousePosition.Y - this.heightRectangle + 7;
                TopLeftCorner_X = X_begin;
                TopLeftCorner_Y = Y_begin;
                if (okButtonRightPressed)
                {
                    this.moveOnScreenRectangle();
                }
            }
        }
Пример #3
0
        private static Image resizeImageCorrectly(Image img)
        {
            double ratio = PacientData.getRatio();

            if (Math.Abs(ratio - 1.7660377) < 0.000001)
            {
                return(resizeByParameter(img, 468));
            }

            else if (Math.Abs(ratio - 1.5705128) < 0.000001)
            {
                return(resizeByParameter(img, 245));
            }
            else if (Math.Abs(ratio - 1.525641) < 0.000001)
            {
                return(resizeByParameter(img, 238));
            }
            else if (Math.Abs(ratio - 1.4807692) < 0.000001)
            {
                return(resizeByParameter(img, 231));
            }
            else if (Math.Abs(ratio - 1.5217391) < 0.000001)
            {
                return(resizeByParameter(img, 245));
            }
            else if (Math.Abs(ratio - 1.4782608) < 0.000001)
            {
                return(resizeByParameter(img, 238));
            }
            else if (Math.Abs(ratio - 1.4347826) < 0.000001)
            {
                return(resizeByParameter(img, 231));
            }

            return(img);
        }