コード例 #1
0
 private void EntradaRatio_TextChanged(object sender, EventArgs e)
 {
     if (EntradaRatio.TextKey == "-1")
     {
         this.CropRect       = System.Drawing.Rectangle.Empty;
         this.SelectionRatio = -1;
     }
     else
     {
         this.SelectionRatio = Lfx.Types.Parsing.ParseDecimal(EntradaRatio.TextKey);
         CropRect.Width      = System.Convert.ToInt32(CropRect.Height * SelectionRatio);
     }
     EntradaImagen.Invalidate();
 }
コード例 #2
0
        private void EntradaImagen_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Middle)
            {
                switch (MouseAction)
                {
                case MouseActions.Draw:
                    CropRect = RectangleFromPoints(StartPoint, e.Location);
                    if (this.SelectionRatio != 0)
                    {
                        CropRect.Width = System.Convert.ToInt32(CropRect.Height * SelectionRatio);
                    }
                    EntradaImagen.Invalidate();
                    break;

                case MouseActions.Drag:
                    CropRect.X = e.X - StartPoint.X;
                    CropRect.Y = e.Y - StartPoint.Y;
                    EntradaImagen.Invalidate();
                    break;
                }
            }
        }