Exemplo n.º 1
0
        private RectangleF GetRect(string s, int i)
        {
            SizeF     sf = ObjectFont.Measure(CurrentGraphics, s);
            Rectangle R  = Area.Canvas.Rect;

            return(new RectangleF(pfStart[i].X, R.Top, sf.Width, R.Height));
        }
Exemplo n.º 2
0
        public virtual RectangleF GetTextRect(int LineNumber, bool Horizon)
        {
            if (CurrentGraphics != null)
            {
                SizeF      sf = ObjectFont.Measure(CurrentGraphics, GetStr());
                RectangleF R  = RectangleF.Empty;
                if (Horizon)
                {
                    R = new RectangleF(
                        pfStart[LineNumber].X, pfStart[LineNumber].Y - sf.Height,
                        pfEnd[LineNumber].X - pfStart[LineNumber].X, sf.Height * 2);
                }
                else
                {
                    R = new RectangleF(
                        pfStart[LineNumber].X - sf.Width, pfStart[LineNumber].Y,
                        sf.Width * 2, pfEnd[LineNumber].Y - pfStart[LineNumber].Y);
                }
                if (R.Width < 0)
                {
                    R.X    += R.Width;
                    R.Width = -R.Width;;
                }
                if (R.Height < 0)
                {
                    R.Y     += R.Height;
                    R.Height = -R.Height;
                }
                R.Width  = Math.Max(R.Width, sf.Width);
                R.Height = Math.Max(R.Height, sf.Height);

                return(R);
            }
            return(RectangleF.Empty);
        }
Exemplo n.º 3
0
        public override void Draw(Graphics g)
        {
            base.Draw(g);
            sf = SizeF.Empty;
            for (int i = 0; i < split.Length; i++)
            {
                try
                {
                    ObjectFont.DrawString(GetStr(i), g, GetRect(i));
                }
                catch
                {
                }
            }

            Pen       P  = LinePen.GetPen();
            PointF    p1 = ToPointF(ControlPoints[0]);
            PointF    p2 = ToPointF(ControlPoints[1]);
            Rectangle R  = Area.Canvas.Rect;

            if (InMove && p1 != PointF.Empty && p2 != PointF.Empty)
            {
                g.DrawLine(P, p1.X, p1.Y, p2.X, p2.Y);
            }
        }
Exemplo n.º 4
0
		public override void PaintValue(PaintValueEventArgs e)
		{
			ObjectFont of = (ObjectFont)e.Value;
			TextRenderingHint trh = e.Graphics.TextRenderingHint;
			e.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
			of.DrawString("A",e.Graphics,e.Bounds);
			e.Graphics.TextRenderingHint  = trh;
			base.PaintValue (e);
		}
Exemplo n.º 5
0
        private RectangleF GetRect(int i)
        {
            SizeF sf = ObjectFont.Measure(CurrentGraphics, GetStr(i));
            float X  = Math.Min(pfStart[i].X, pfEnd[i].X);
            float Y  = pfStart[i].Y;
            float W  = Math.Max(Math.Abs(pfStart[i].X - pfEnd[i].X), sf.Width);
            float H  = sf.Height;

            return(new RectangleF(X, Y, W, H));
        }
Exemplo n.º 6
0
 public override void Draw(Graphics g)
 {
     base.Draw(g);
     if (showCycleText)
     {
         for (int i = 0; i < pfStart.Length; i++)
         {
             string s = GetStr(i);
             ObjectFont.DrawString(s, g, GetRect(s, i));
         }
     }
 }
Exemplo n.º 7
0
 public override void Draw(Graphics g)
 {
     base.Draw(g);
     sf = SizeF.Empty;
     for (int i = 0; i < split.Length; i++)
     {
         try
         {
             ObjectFont.DrawString(GetStr(i), g, GetRect(i));
         }
         catch
         {
         }
     }
 }
Exemplo n.º 8
0
        public override void Draw(Graphics g)
        {
            base.Draw(g);

            string s = GetStr();

            if (s != null)
            {
                s = s.Trim();
                RectangleF TextRect = GetTextRect();
                RectangleF R        = ObjectFont.GetTextBackRect(s, g, TextRect);
                R.Height--;
                if (ObjectFont.LineAlignment == StringAlignment.Near)
                {
                    R.Y++;
                }

                if (textBackBrush != null)
                {
                    if (textBackBrush.BrushStyle != BrushMapperStyle.Empty)
                    {
                        Brush B = textBackBrush.GetBrush(R);
                        g.FillRectangle(B, R);
                    }
                }
                if (textFramePen != null)
                {
                    if (textFramePen.Alpha > 0)
                    {
                        Pen P = textFramePen.GetPen();
                        g.DrawRectangles(P, new RectangleF[] { R });
                    }
                }
                ObjectFont.DrawString(s, g, GetTextRect());
            }
        }
Exemplo n.º 9
0
 public BaseTextObject()
 {
     objectFont = new ObjectFont();
 }