Exemple #1
0
        public RectangleF GetBoundingRect(ICanvas canvas)
        {
            try
            {
                float thWidth = LineTool.ThresholdWidth(canvas, Width, ThresholdPixel);
                if (thWidth < Width)
                {
                    thWidth = Width;
                }

                RectangleF rect = RectangleF.Empty;
                if (m_p2.IsEmpty || m_p3.IsEmpty)
                {
                    rect = ScreenUtils.GetRect(m_p1, m_lastPoint, thWidth);
                }

                if (rect.IsEmpty)
                {
                    float r = m_radius + thWidth / 2;
                    rect = HitUtil.CircleBoundingRect(m_center, r);
                    if (Selected)
                    {
                        float w = (float)canvas.ToUnit(20);
                        rect.Inflate(w, w);
                    }
                }
                if (m_lastPoint.IsEmpty == false)
                {
                    rect = RectangleF.Union(rect, new RectangleF(m_lastPoint.Point, new SizeF(0, 0)));
                }
                return(rect);
            }
            catch (Exception ex)
            { throw ex; }
        }
Exemple #2
0
 /// <summary>
 /// 得到当前图形元素的矩形区域
 /// </summary>
 public RectangleF GetBoundingRect(ICanvas canvas)
 {
     try
     {
         float thWidth = LineTool.ThresholdWidth(canvas, Width, ThresholdPixel);
         if (thWidth < Width)
         {
             thWidth = Width;
         }
         float     ProduceWidth = canvas.ToScreen(width / 96);
         float     ProduceHight = canvas.ToScreen(height / 96);
         UnitPoint Aqlocation   = new UnitPoint(location.X + canvas.ToUnit(ProduceWidth), location.Y - canvas.ToUnit(ProduceHight));
         return(ScreenUtils.GetRect(location, Aqlocation, thWidth));
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemple #3
0
 public virtual bool PointInObject(ICanvas canvas, UnitPoint point)
 {
     try
     {
         RectangleF boundingrect = GetBoundingRect(canvas);
         if (boundingrect.Contains(point.Point) == false)
         {
             return(false);
         }
         float thWidth = LineTool.ThresholdWidth(canvas, Width, ThresholdPixel);
         if (HitUtil.PointInPoint(m_center, point, thWidth))
         {
             return(true);
         }
         return(HitUtil.IsPointInCircle(m_center, m_radius, point, thWidth / 2));
     }
     catch (Exception ex)
     { throw ex; }
 }
Exemple #4
0
        /// <summary>
        /// 得到当前图形元素的矩形区域
        /// </summary>
        public RectangleF GetBoundingRect(ICanvas canvas)
        {
            try
            {
                //Font m_font = new System.Drawing.Font("Arial Black", FontSize, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                //SizeF size= canvas.GetStrValueSize(StrValue, m_font);
                //UnitPoint aqlocation = new UnitPoint(location.X + (float)canvas.ToUnit(size.Width), location.Y - (float)canvas.ToUnit(size.Height));
                //return ScreenUtils.GetRect(location, aqlocation, 0);


                float thWidth = LineTool.ThresholdWidth(canvas, Width, ThresholdPixel);
                if (thWidth < Width)
                {
                    thWidth = Width;
                }
                UnitPoint Aqlocation = new UnitPoint(location.X + canvas.ToUnit((float)10 * str_value.Length), location.Y - canvas.ToUnit(10F));
                return(ScreenUtils.GetRect(location, Aqlocation, thWidth));
            }
            catch (Exception ex)
            { throw ex; }
        }
Exemple #5
0
        public RectangleF GetBoundingRect(ICanvas canvas)
        {
            float thWidth = LineTool.ThresholdWidth(canvas, Width, ThresholdPixel);

            return(ScreenUtils.GetRect(new UnitPoint(position.X - 0.2, position.Y + 0.2), new UnitPoint(position.X + 0.2, position.Y - 0.2), thWidth));
        }