NormalizedRect() публичный статический Метод

public static NormalizedRect ( PointF p1, PointF p2 ) : RectangleF
p1 System.Drawing.PointF
p2 System.Drawing.PointF
Результат System.Drawing.RectangleF
Пример #1
0
        public override void CreationMouseUpHandler(PointF point)
        {
            RectangleF rect = Helpers.NormalizedRect(currentRectangle.Location, point);

            currentRectangle = rect;
            tpText.BackColor = backColor;
        }
Пример #2
0
        public override void Draw(Graphics g, float zoom, PointF offset, PointF zoomPosition)
        {
            var rect = Helpers.NormalizedRect(currentRectangle.Location,
                                              new PointF(currentRectangle.Right, currentRectangle.Bottom));

            int x0 = (int)(rect.Left * zoom + offset.X);
            int y0 = (int)(rect.Top * zoom + offset.Y);
            int x1 = (int)(rect.Width * zoom);
            int y1 = (int)(rect.Height * zoom);

            if (x1 == 0 || y1 == 0)
            {
                return;
            }


            using (var pen = new Pen(borderColor))
            {
                if (ImageViewPort.CastShadow)
                {
                    using (var pen2 = new Pen(Color.FromArgb(64, 0, 0, 0)))
                    {
                        pen2.Width = borderSize;
                        g.DrawRectangle(pen2, x0 + (int)(3 * zoom), y0 + (int)(3 * zoom), x1, y1);
                    }
                }

                pen.Width = borderSize;
                g.DrawRectangle(pen, x0, y0, x1, y1);
            }
        }
Пример #3
0
        public override void Draw(Graphics g, float zoom, PointF offset, PointF zoomPosition, Point tbOffset)
        {
            RectangleF rect = Helpers.NormalizedRect(currentRectangle.Location,
                                                     new PointF(currentRectangle.Right, currentRectangle.Bottom));

            int x0 = (int)(rect.Left * zoom + offset.X);
            int y0 = (int)(rect.Top * zoom + offset.Y);
            var x1 = (int)(rect.Width * zoom);
            var y1 = (int)(rect.Height * zoom);

            textAreaRect = new Rectangle(x0, y0, x1, y1);

            if (x1 == 0 || y1 == 0)
            {
                return;
            }

            var arrow = new Point((int)(arrowPoint.point.X * zoom + offset.X), (int)(arrowPoint.point.Y * zoom + offset.Y));

            if (ImageViewPort.CastShadow)
            {
                GraphicsPath pth2 = Create(x0 + (int)(3 * zoom), y0 + (int)(3 * zoom), (int)textAreaRect.Width, (int)textAreaRect.Height, 7,
                                           true, arrow);
                using (Brush backBrush = new SolidBrush(Color.FromArgb(64, 0, 0, 0)))
                {
                    g.FillPath(backBrush, pth2);
                }
            }

            var pth = Create(x0, y0, (int)textAreaRect.Width, (int)textAreaRect.Height, 7, true, arrow);

            using (Brush backBrush = new SolidBrush(backColor))
            {
                using (var pen = new Pen(borderColor))
                {
                    pen.Width = borderSize;
                    g.FillPath(backBrush, pth);
                    g.DrawPath(pen, pth);
                }
            }

            var tmpRect = new Rectangle((int)textAreaRect.Location.X + 4, (int)textAreaRect.Location.Y + 4,
                                        (int)textAreaRect.Size.Width - 8, (int)textAreaRect.Size.Height - 8);

            if (EditMode)
            {
                if (needToUpdateTb)
                {
                    tpText.Size = new Size(tmpRect.Width, tmpRect.Height);

                    tpText.Location = new Point(tmpRect.Location.X + tbOffset.X, tmpRect.Location.Y + tbOffset.Y);
                    needToUpdateTb  = false;
                }
            }
            else if (textAreaImage != null)
            {
                g.DrawImageUnscaledAndClipped(textAreaImage, tmpRect);
            }
        }
Пример #4
0
        public RectangleF GetLastModifiedRect()
        {
            int count = freeLine.Count;

            if (count < 2)
            {
                return(new RectangleF());
            }
            RectangleF rect = Helpers.NormalizedRect(freeLine[count - 1], freeLine[count - 2]);

            rect.Offset(-5, -5);
            rect.Inflate(10, 10);
            return(rect);
        }
Пример #5
0
        public override void Draw(Graphics g, float zoom, PointF offset, PointF zoomPosition)
        {
            var rect = Helpers.NormalizedRect(currentRectangle.Location,
                                              new PointF(currentRectangle.Right, currentRectangle.Bottom));


            var x0 = (int)(rect.Left * zoom) + offset.X;
            var y0 = (int)(rect.Top * zoom) + offset.Y;
            var x1 = (int)(rect.Width * zoom);
            var y1 = (int)(rect.Height * zoom);


            new Size((int)(currentRectangle.Width * zoom), (int)(currentRectangle.Height * zoom));
            if (ImageViewPort.CastShadow)
            {
                using (Brush brush = new SolidBrush(Color.FromArgb(64, 0, 0, 0)))
                {
                    g.FillRectangle(brush, new RectangleF(x0 + (int)(3 * zoom), y0 + (int)(3 * zoom), x1, y1));
                }
            }
            g.DrawImage(originalPicture, new RectangleF(x0, y0, x1, y1));
        }
Пример #6
0
 public RectangleF GetLastModifiedRect()
 {
     return(Helpers.NormalizedRect(begin, end));
 }
Пример #7
0
        public override void CreationMouseUpHandler(PointF point)
        {
            var rect = Helpers.NormalizedRect(currentRectangle.Location, point);

            currentRectangle = rect;
        }