Ejemplo n.º 1
0
 public static void GetDrContext(System.Windows.Media.DrawingContext drawingContext, LIVE_TYPE type, bool isSelect, string name)
 {
     if (type == LIVE_TYPE.HUMANOID)
     {
         drawingContext.DrawEllipse(new SolidColorBrush(Colors.Red), new Pen(new SolidColorBrush(Colors.Black), 1), new System.Windows.Point(15, 6), 3, 3);
         drawingContext.DrawEllipse(new SolidColorBrush(Colors.Red), new Pen(new SolidColorBrush(Colors.Black), 1), new System.Windows.Point(15, 15), 3, 5);
         drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Black), 1), new Point(14, 20), new Point(12, 27));
         drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Black), 1), new Point(16, 20), new Point(18, 27));
         drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Black), 1), new Point(14, 11), new Point(7, 13));
         drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Black), 1), new Point(16, 11), new Point(23, 13));
         drawingContext.DrawText(new FormattedText(name, System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Arial"), 12, new SolidColorBrush(Colors.Green)), new Point(0, 30));
         if (isSelect)
         {
             drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Green), 1), new Point(7, 11), new Point(7, 27));
         }
     }
     if (type == LIVE_TYPE.DOG)
     {
         drawingContext.DrawEllipse(new SolidColorBrush(Colors.Blue), new Pen(new SolidColorBrush(Colors.Black), 1), new System.Windows.Point(10, 15), 3, 3);
         drawingContext.DrawEllipse(new SolidColorBrush(Colors.Blue), new Pen(new SolidColorBrush(Colors.Black), 1), new System.Windows.Point(15, 20), 5, 3);
         drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Black), 1), new Point(12, 23), new Point(10, 27));
         drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Black), 1), new Point(12, 23), new Point(14, 27));
         drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Black), 1), new Point(18, 23), new Point(16, 27));
         drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Black), 1), new Point(18, 23), new Point(20, 27));
         drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Black), 1), new Point(20, 20), new Point(23, 14));
         drawingContext.DrawText(new FormattedText(name, System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Arial"), 12, new SolidColorBrush(Colors.Green)), new Point(0, 30));
         if (isSelect)
         {
             drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Green), 1), new Point(7, 11), new Point(7, 27));
         }
     }
 }
Ejemplo n.º 2
0
        protected override void DrawText(int index, System.Windows.Media.DrawingContext drawingContext, ref Brush brush)
        {
            if (this.ActualWidth - SCROLLBARWIDTH < 0)
            {
                return;
            }

            FormattedText text       = FormatText(getText(index), brush);
            int           fromborder = 0;

            if (pItem[Findlist[index]].Playing)
            {
                text.SetFontWeight(FontWeights.Bold);
            }

            if (string.IsNullOrEmpty(pItem[Findlist[index]].Duration))
            {
                drawingContext.DrawText(text, new Point(3, (index - LowIndex) * ISize + 3));
            }
            else
            {
                fromborder         = 6 + pItem[Findlist[index]].Duration.Length * 5;
                text.MaxTextWidth -= fromborder;
                drawingContext.DrawText(text, new Point(3, (index - LowIndex) * ISize + 3));
                text = FormatText(pItem[Findlist[index]].Duration, brush);


                if ((item != null) && HighIndex - LowIndex < GetCount() - 1)
                {
                    fromborder += SCROLLBARWIDTH;
                }
                drawingContext.DrawText(text, new Point(this.ActualWidth - fromborder, (index - LowIndex) * ISize + 3));
            }
        }
        protected override void OnRender(DrawingContext dc)
        {
            Point curPoint = new Point(0, 0);

            dc.DrawText(MakeText("Row Number"), curPoint);
            curPoint.X += ColumnWidth;
            for (int i = 1; i < 4; i++)
            {
                dc.DrawText(MakeText("Column " + i), curPoint);
                curPoint.X += ColumnWidth;
            }

            curPoint.X = 0;
            curPoint.Y += LineHeight;

            dc.DrawRectangle(Brushes.Black, null,
              new Rect(curPoint, new Size(Width, 2)));
            curPoint.Y += HeaderHeight - LineHeight;

            Random numberGen = new Random();
            for (int i = _CurrentRow; i < _CurrentRow + _Rows; i++)
            {
                dc.DrawText(MakeText(i.ToString()), curPoint);
                curPoint.X += ColumnWidth;
                for (int j = 1; j < 4; j++)
                {
                    dc.DrawText(MakeText(numberGen.Next().ToString()), curPoint);
                    curPoint.X += ColumnWidth;
                }
                curPoint.Y += LineHeight;
                curPoint.X = 0;
            }
        }
Ejemplo n.º 4
0
        public void Init_DrawLT(int running_train)
        {
            int i;
            int temp;
            int late_time_range;
            late_time_range = 1000;
            temp = 0;
            x1 = 30;
            y1 = 10;
            x2 = 700;
            y2 = 580;
            narrow_x = (double)running_train / (x2 - x1);
            narrow_y = (double)late_time_range / (y2 - y1);
            drawingVisual = new DrawingVisual();
            dc = drawingVisual.RenderOpen();
            dc.DrawLine(new Pen(Brushes.Black, 1.5), new Point(x1, x1), new Point(x1, y2));
            dc.DrawLine(new Pen(Brushes.Black, 1.5), new Point(x1, y2), new Point(x2, y2));
            dc.DrawText(new FormattedText("N",
                    CultureInfo.GetCultureInfo("en-us"),
                    FlowDirection.LeftToRight,
                    new Typeface("Verdana"),
                    12, System.Windows.Media.Brushes.Black),
                    new System.Windows.Point(x2 - 30, y2 + 6));
            dc.DrawText(new FormattedText("T",
                      CultureInfo.GetCultureInfo("en-us"),
                      FlowDirection.LeftToRight,
                      new Typeface("Verdana"),
                      12, System.Windows.Media.Brushes.Black),
                      new System.Windows.Point(x1 - 10, y1 - 8));

            for (i = 0; i < (x2 - x1); i++)
            {
                if (i % ((x2 - x1) / 5) == 0)
                {
                    dc.DrawLine(new Pen(Brushes.Black, 1.5), new Point(x1 + i, y2), new Point(x1 + i, y2 - 3));
                    dc.DrawText(new FormattedText((temp * running_train / 5).ToString(),
                      CultureInfo.GetCultureInfo("en-us"),
                      FlowDirection.LeftToRight,
                      new Typeface("Verdana"),
                      12, System.Windows.Media.Brushes.Black),
                      new System.Windows.Point(i + x1 - 5, y2 + 7));
                    temp++;
                }
            }
            temp = 0;
            for (i = 0; i < (y2 - y1); i++)
            {
                if (i % ((y2 - y1) / 5) == 0)
                {
                    dc.DrawLine(new Pen(Brushes.Black, 1.5), new Point(x1, y2 - i), new Point(x1 + 3, y2 - i));
                    dc.DrawText(new FormattedText((temp * late_time_range / 5).ToString(),
                      CultureInfo.GetCultureInfo("en-us"),
                      FlowDirection.LeftToRight,
                      new Typeface("Verdana"),
                      12, System.Windows.Media.Brushes.Black),
                      new System.Windows.Point(x1 - 28, y2 - i - 9));
                    temp++;
                }
            }
        }
Ejemplo n.º 5
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            var fe = AdornedElement as FrameworkElement;
            if (fe == null)
            {
                return;
            }

            var rect = new Rect(1, 1, Math.Max(0, fe.ActualWidth - 2), Math.Max(0, fe.ActualHeight - 2));
            var color = Colors.Red;
            var brush = new SolidColorBrush(color);
            var pen = new Pen(brush, 1);
            pen.Freeze();

            var dashPen = new Pen(brush, 1) { DashStyle = new DashStyle(new double[] { 1, 6 }, 0) };
            dashPen.Freeze();

            var guidelineSet = new GuidelineSet();
            guidelineSet.GuidelinesX.Add(0.5);
            guidelineSet.GuidelinesY.Add(0.5);

            //var outlinePen = new Pen(new SolidColorBrush(Color.FromArgb(0x70, 0xFF, 0xFF, 0xFF)), 5);
            //outlinePen.Freeze();

            drawingContext.PushGuidelineSet(guidelineSet);

            //drawingContext.DrawRectangle(null, outlinePen, rect);
            drawingContext.DrawRectangle(null, pen, rect);

            //var parent = VisualTreeHelper.GetParent(fe) as FrameworkElement;
            //if (parent != null)
            //{
            //    var thisLeft = new Point(0, fe.ActualHeight / 2);
            //    var thisRight = new Point(fe.ActualWidth, fe.ActualHeight / 2);
            //    var thisTop = new Point(fe.ActualWidth / 2, 0);
            //    var thisBottom = new Point(fe.ActualWidth / 2, fe.ActualHeight);
            //    var ancestorLeft = new Point(parent.TranslatePoint(thisLeft, fe).X, thisLeft.Y);
            //    var ancestorRight = ancestorLeft + new Vector(parent.ActualWidth, 0);
            //    var ancestorTop = new Point(thisTop.X, parent.TranslatePoint(new Point(), fe).Y);
            //    var ancestorBottom = new Point(thisBottom.X, parent.TranslatePoint(new Point(), fe).Y + parent.ActualHeight);

            //    var leftPen = fe.HorizontalAlignment == HorizontalAlignment.Left || fe.HorizontalAlignment == HorizontalAlignment.Stretch ? pen : dashPen;
            //    var rightPen = fe.HorizontalAlignment == HorizontalAlignment.Right || fe.HorizontalAlignment == HorizontalAlignment.Stretch ? pen : dashPen;
            //    var topPen = fe.VerticalAlignment == VerticalAlignment.Top || fe.VerticalAlignment == VerticalAlignment.Stretch ? pen : dashPen;
            //    var bottomPen = fe.VerticalAlignment == VerticalAlignment.Bottom || fe.VerticalAlignment == VerticalAlignment.Stretch ? pen : dashPen;

            //    drawingContext.DrawLine(leftPen, thisLeft, ancestorLeft);
            //    drawingContext.DrawLine(rightPen, thisRight, ancestorRight);
            //    drawingContext.DrawLine(topPen, thisTop, ancestorTop);
            //    drawingContext.DrawLine(bottomPen, thisBottom, ancestorBottom);
            //}

            var formattedHeight = new FormattedText(string.Format("{0:0}", fe.ActualHeight), CultureInfo.InvariantCulture, FlowDirection.LeftToRight, TypeFace, 10, brush);
            var formattedWidth = new FormattedText(string.Format("{0:0}", fe.ActualWidth), CultureInfo.InvariantCulture, FlowDirection.LeftToRight, TypeFace, 10, brush);
            drawingContext.DrawText(formattedHeight, new Point(rect.Width + 5, (rect.Height / 2) - (formattedHeight.Height / 2)));
            drawingContext.DrawText(formattedWidth, new Point(rect.Width / 2 - formattedWidth.Width / 2, rect.Height + 5));

            drawingContext.Pop();
        }
Ejemplo n.º 6
0
 public void Init_DrawSP(ArrayList sp, int track_len, int v_max)
 {
     int i;
     int temp;
     mysp = sp;
     temp = 0;
     x1 = 30;
     y1 = 10;
     x2 = 700;
     y2 = 580;
     narrow_x = (double)track_len / (x2-x1);
     narrow_y = (double)v_max / ((y2 - y1) / 2);
     drawingVisual = new DrawingVisual();
     dc = drawingVisual.RenderOpen();
     dc.DrawLine(new Pen(Brushes.Black, 1.5), new Point(x1, x1), new Point(x1, y2));
     dc.DrawLine(new Pen(Brushes.Black, 1.5), new Point(x1, y2), new Point(x2, y2));
     dc.DrawText(new FormattedText("T",
               CultureInfo.GetCultureInfo("en-us"),
               FlowDirection.LeftToRight,
               new Typeface("Verdana"),
               12, System.Windows.Media.Brushes.Black),
               new System.Windows.Point(x2 - 30, y2 + 6));
     dc.DrawText(new FormattedText("V",
               CultureInfo.GetCultureInfo("en-us"),
               FlowDirection.LeftToRight,
               new Typeface("Verdana"),
               12, System.Windows.Media.Brushes.Black),
               new System.Windows.Point(x1 - 10, y1 - 8));
     for (i = 0; i < (x2 - x1); i++)
     {
         if (i % ((x2 - x1) / 5) == 0)
         {
             dc.DrawLine(new Pen(Brushes.Black, 1.5), new Point(x1 + i, y2), new Point(x1 + i, y2 - 3));
             dc.DrawText(new FormattedText((temp * track_len / 5).ToString(),
               CultureInfo.GetCultureInfo("en-us"),
               FlowDirection.LeftToRight,
               new Typeface("Verdana"),
               12, System.Windows.Media.Brushes.Black),
               new System.Windows.Point(i + x1 - 5, y2 + 7));
             temp++;
         }
     }
     temp = 0;
     for (i = 0; i < (y2 - y1)/2; i++)
     {
         if (i % ((y2 - y1) / 10) == 0)
         {
             dc.DrawLine(new Pen(Brushes.Black, 1.5), new Point(x1, y2 - i), new Point(x1 + 3, y2 - i));
             dc.DrawText(new FormattedText((temp * v_max / 5).ToString(),
               CultureInfo.GetCultureInfo("en-us"),
               FlowDirection.LeftToRight,
               new Typeface("Verdana"),
               12, System.Windows.Media.Brushes.Black),
               new System.Windows.Point(x1 - 28, y2 - i - 9));
             temp++;
         }
     }
 }
Ejemplo n.º 7
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            if (Sequence != null)
            {
                FormattedText seqText = new FormattedText(Sequence.ToString(), CultureInfo.CurrentUICulture,
                                                          FlowDirection.LeftToRight, new Typeface("Courier New"), 12.0,
                                                          new SolidColorBrush(Colors.Black));

                // If we can't fit the sequence, we need to come up with a compressed representation
                if (seqText.Width > ActualWidth)
                {
                    double marginX    = 10.0;
                    double marginY    = 3.0;
                    double barMarginY = marginY + seqText.Height + 2.0;
                    double barWidth   = ActualWidth - (marginX * 2.0);
                    double vertHeight = 5.0;
                    Pen    seqLinePen = new Pen(new SolidColorBrush(Colors.Black), 1.0);

                    // Draw the horizontal bar
                    drawingContext.DrawLine(seqLinePen, new Point(marginX, barMarginY), new Point(ActualWidth - marginX, barMarginY));

                    // Determine the number of verticals
                    int spaceLength = 100;
                    if (Sequence.Count > 1000)
                    {
                        spaceLength = 250;
                    }
                    if (Sequence.Count > 5000)
                    {
                        spaceLength = 1000;
                    }
                    if (Sequence.Count > 10000)
                    {
                        spaceLength = 2500;
                    }
                    int    vertCount   = (int)(Sequence.Count / spaceLength) + 1;
                    double vertSpacing = barWidth / (double)vertCount;

                    // Draw the vertical bars and annotation
                    for (int i = 0; i <= vertCount; i++)
                    {
                        double x = (vertSpacing * (double)i) + marginX;
                        drawingContext.DrawLine(seqLinePen, new Point(x, barMarginY), new Point(x, barMarginY + vertHeight));

                        FormattedText annotation = new FormattedText((spaceLength * i).ToString(), CultureInfo.CurrentUICulture,
                                                                     FlowDirection.LeftToRight, new Typeface("Courier New"), 10.0,
                                                                     new SolidColorBrush(Colors.DarkGray));
                        double textX = x - (annotation.Width / (i == vertCount ? 1.0 : 2.0));
                        drawingContext.DrawText(annotation, new Point(textX, marginY));
                    }
                } // Otherwise just draw the text sequence in there
                else
                {
                    drawingContext.DrawText(seqText, new Point(10.0, 10.0));
                }
            }
            base.OnRender(drawingContext);
        }
Ejemplo n.º 8
0
        private void RenderHorizontal(DrawingContext dc)
        {
            Pen p = new Pen(Brushes.Black, 1);
            Pen q = new Pen(Brushes.LightGray, 1);

            double padLeft = Padding.Left;
            double padBottom = Padding.Bottom - 2 + 10;
            double padTop = Padding.Top;
            double padRight = Padding.Right;

            // Draw horizontal gridlines

            for (int i = 0; i < 5; i++)
            {
                double y = (int)(padTop + (4 - i) * ((ActualHeight - padBottom - padTop) / 4.0)) - 0.5;
                if (i != 2)
                    dc.DrawLine(q, new Point(padLeft, y), new Point(ActualWidth - padRight, y));
                dc.DrawLine(p, new Point(padLeft - 10, y), new Point(padLeft, y));
                var t = FT((i / 2.0 - 1).ToString("0.0"), 10);
                dc.DrawText(t, new Point(padLeft - t.Width - 12, y - t.Height / 2));
            }

            // Draw vertical gridlines

            for (int i = 0; i < 11; i++)
            {
                double x = (int)(padLeft + (10 - i) * ((ActualWidth - padLeft - padRight) / 10.0)) - 0.5;
                if (i < 10)
                    dc.DrawLine(q, new Point(x, ActualHeight - padBottom), new Point(x, padTop));
                dc.DrawLine(p, new Point(x, ActualHeight - padBottom + 10), new Point(x, ActualHeight - padBottom));

                var t = FT(i.ToString(), 10);
                dc.DrawText(t, new Point(x - t.Width / 2, ActualHeight - padBottom + t.Height));
            }

            // Draw y axis

            dc.DrawLine(p, new Point(((int)padLeft) - 0.5, padTop), new Point(((int)padLeft) - 0.5, ActualHeight - padBottom));

            // Draw x axis
            dc.DrawLine(p, new Point(padLeft, ((int)((ActualHeight - padBottom - padTop) / 2 + padTop)) - 0.5), new Point(ActualWidth - padRight, ((int)((ActualHeight - padBottom - padTop) / 2 + padTop)) - 0.5));

            // Draw x axis label

            FormattedText ft = FT("History (seconds)", 20);
            dc.DrawText(ft, new Point(padLeft + (ActualWidth - padLeft - padRight) / 2 - ft.Width / 2, ActualHeight - ft.Height));

            // Draw y axis label

            ft = FT(RangeLabel, 20);
            dc.PushTransform(new RotateTransform(-90));
            dc.DrawText(ft, new Point(-ft.Width - ActualHeight / 2 + ft.Width / 2, 0));
        }
Ejemplo n.º 9
0
 public void Render(DrawingContext drawingContext, Point position, object item)
 {
     FileViewModel fileViewModel = item as FileViewModel;
       if (fileViewModel == null) return;
       FormattedText formattedText = new FormattedText(fileViewModel.Name, CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
     m_typeface, 14, Brushes.White);
       drawingContext.DrawText(formattedText, position);
       string path = Path.GetDirectoryName(fileViewModel.Path) ?? "";
       path = path.Length > ShortenPath ? path.Substring(ShortenPath, path.Length - ShortenPath) : "\\";
       FormattedText formattedTextSmall = new FormattedText(path, CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
     m_typeface, 10, Brushes.LightSlateGray);
       drawingContext.DrawText(formattedTextSmall, new Point(position.X + 5, position.Y + formattedText.Height));
 }
Ejemplo n.º 10
0
 public static void DrawTextLeftAligned(this FormattedText ft, DrawingContext dc, Point topLeft)
 {
     if (ft.Text.Length > 0)
     {
         if (char.IsWhiteSpace(ft.Text[0]))
         {
             dc.DrawText(ft, new Point(topLeft.X, topLeft.Y));
         }
         else
         {
             dc.DrawText(ft, new Point(topLeft.X - ft.OverhangLeading, topLeft.Y));
         }
     }
 }
Ejemplo n.º 11
0
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     base.OnRender(drawingContext);
     drawingContext.DrawRectangle(new SolidColorBrush(Colors.Red), new Pen(new SolidColorBrush(Colors.Black), 1), new Rect(new Size(this.Width, this.Height)));
     drawingContext.DrawRectangle(new SolidColorBrush(Colors.Green), new Pen(new SolidColorBrush(Colors.Black), 1), new Rect(new Size(this.Width * Health, this.Height)));
     drawingContext.DrawText(new FormattedText(_name, System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Arial"), 10, new SolidColorBrush(Colors.White)), new Point(0, 0));
 }
 protected override void OnRender(DrawingContext drawingContext)
 {
     foreach (MyText text in texts) {
         drawingContext.DrawText(text.line, text.Position);
     }
     Dispatcher.BeginInvoke(DispatcherPriority.Input, new Action(delegate { OnFrameRendered(EventArgs.Empty); }));
 }
Ejemplo n.º 13
0
        protected override void DrawPointElement(DrawingContext dc, int Zoom)
        {
            if (Zoom > 12 || IsMouseOver)
            {
                string postLabelText = string.Format("{0}км", (double)Post.Ordinate / 1000);
                var postLabel = new FormattedText(postLabelText, CultureInfo.CurrentCulture,
                                                  FlowDirection.LeftToRight, new Typeface("Verdana"), 10, mainBrush);

                const int flagHeight = 22;
                dc.PushTransform(new TranslateTransform(0, -flagHeight));

                dc.DrawRectangle(Brushes.White, new Pen(mainBrush, 1), new Rect(-0.5, -0.5, Math.Round(postLabel.Width) + 5, Math.Round(postLabel.Height) + 2));
                dc.DrawText(postLabel, new Point(2, 0));
                dc.DrawLine(new Pen(mainBrush, 2), new Point(0, 0), new Point(0, flagHeight));

                dc.Pop();
            }

            if (Zoom > 8)
                dc.DrawEllipse(SectionBrush, new Pen(mainBrush, 1.5), new Point(0, 0), 5, 5);
            else
                dc.DrawRectangle(SectionBrush, null, new Rect(-2, -2, 4, 4));

            if (IsMouseOver)
            {
                dc.PushTransform(new TranslateTransform(3, 10));
                PrintStack(dc,
                           new FormattedText(Post.Direction == OrdinateDirection.Increasing ? "Возрастает по неч." : "Убывает по неч.",
                                             CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Verdana"), 10, Brushes.DarkBlue),
                           new FormattedText(String.Format("Пути: {0}", string.Join(", ", Post.Tracks.Select(TrackName))),
                                             CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Verdana"), 10, Brushes.DarkOliveGreen));
                dc.Pop();
            }
        }
Ejemplo n.º 14
0
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     for (int i = 0; i < Steps + 1; ++i)
     {
         var value    = (Maximum - Minimum) / Steps * i + Minimum;
         var location = (MaximumAngle - MinimumAngle) / Steps * i + MinimumAngle;
         var rad      = (90 - location) * Math.PI / 180;
         while (rad > Math.PI * 2)
         {
             rad -= Math.PI * 2;
         }
         while (rad < 0)
         {
             rad += Math.PI * 2;
         }
         var point = new Point(
             ActualWidth / 2 + ActualWidth / 2 * Math.Cos(rad),
             ActualHeight / 2 - ActualHeight / 2 * Math.Sin(rad));
         drawingContext.DrawRectangle(Brushes.Red, null, new Rect(point.X - 2, point.Y - 2, 4, 4));
         var ft = new FormattedText(value.ToString(ScaleFormat),
                                    CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight,
                                    new Typeface("Arial"), 15, Brushes.Red);
         if (Math.Abs(point.X - ActualWidth / 2) < 1)
         {
             point = new Point(point.X - ft.Width / 2, point.Y);
         }
         else if (point.X > ActualWidth / 2)
         {
             point = new Point(point.X - ft.Width, point.Y);
         }
         drawingContext.DrawText(ft, point);
     }
 }
Ejemplo n.º 15
0
 public static void DrawText(this FormattedText ft, DrawingContext dc, Point topLeft)
 {
     if (ft.Text.Length > 0)
     {
         dc.DrawText(ft, new Point(topLeft.X, topLeft.Y));
     }
 }
Ejemplo n.º 16
0
        protected override void OnRender(System.Windows.Media.DrawingContext dc)
        {
            double        num           = this.Maximum - this.Minimum;
            double        y             = this.ReservedSpace * 0.5;
            FormattedText formattedText = null;
            double        x             = 0;
            int           iterationSteps;

            if (this.Minimum == 0)
            {
                iterationSteps = Convert.ToInt32(num);
            }
            else
            {
                iterationSteps = Convert.ToInt32(num) + 1;
            }
            for (double i = this.Minimum; i <= iterationSteps; i += this.TickFrequency)
            {
                formattedText = new FormattedText(i.ToString(), CultureInfo.GetCultureInfo("de-DE"), FlowDirection.LeftToRight,
                                                  new Typeface("Segoe360"), 8, Brushes.White);
                if (this.Minimum == i)
                {
                    x = this.Minimum;
                }
                else
                {
                    x += this.ActualWidth / (num / this.TickFrequency);
                }
                dc.DrawText(formattedText, new Point(x, 10));
            }
        }
Ejemplo n.º 17
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            RotarySwitch rotarySwitch = Visual as RotarySwitch;

            if (rotarySwitch != null)
            {
                if (rotarySwitch.DrawLines)
                {
                    drawingContext.DrawDrawing(_lines);
                }
                foreach (SwitchPositionLabel label in _labels)
                {
                    drawingContext.DrawText(label.Text, label.Location);
                }

                drawingContext.PushTransform(new RotateTransform(rotarySwitch.KnobRotation, _center.X, _center.Y));
                drawingContext.DrawRectangle(_imageBrush, null, _imageRect);
                if (rotarySwitch.VisualizeDragging)
                {
                    double length = (rotarySwitch.DragPoint - _center).Length;
                    drawingContext.DrawLine(HeadingPen, _center, _center + new Vector(0d, -length));
                }
                drawingContext.Pop();

                if (rotarySwitch.VisualizeDragging)
                {
                    drawingContext.DrawLine(DragPen, _center, rotarySwitch.DragPoint);
                }
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Draw the legend item
        /// </summary>
        /// <param name="dc">DrawingContext on which to draw</param>
        /// <param name="position">The position on the drawing context to draw relative to.</param>
        public override void Draw(System.Windows.Media.DrawingContext dc, System.Windows.Point position)
        {
            Pen linePen = new Pen(Brushes.Black, 1.0);

            dc.DrawRectangle(_fill, linePen, new Rect((int)position.X + 2, (int)position.Y + 2, 28, (int)Dimensions.Height - 4));
            dc.DrawText(_formattedText, new Point(38 + position.X, 2 + position.Y));
        }
Ejemplo n.º 19
0
    /// <summary>
    /// When overridden in a derived class, participates in rendering operations that are directed by the layout system. The rendering instructions for this element are not used directly when this method is invoked, and are instead preserved for later asynchronous use by layout and drawing.
    /// </summary>
    /// <param name="drawingContext">The drawing instructions for a specific element. This context is provided to the layout system.</param>
    protected override void OnRender(DrawingContext drawingContext)
    {
      // When no interfaces have been defined, there is nothing to draw.
      if (this.interfaceNames.Count == 0)
      {
        return;
      }

      base.OnRender(drawingContext);

      Pen pen = new Pen(Brushes.Gray, 0.5);
      Point origin = new Point(30, 3);
      double length = Constants.StartHeight + (this.interfaceNames.Count * Constants.LineHeight);

      // draw path at top left
      drawingContext.DrawLine(pen, origin, new Point(origin.X, origin.Y - length));
      drawingContext.DrawEllipse(Brushes.Transparent, pen, new Point(origin.X, origin.Y - length - Constants.Radius), Constants.Radius, Constants.Radius);

      // draw interface names
      origin.Offset(5.0D, -length - Constants.Radius);
      foreach (string name in this.interfaceNames)
      {
        drawingContext.DrawText(new FormattedText(name, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface("Segoe UI"), 7, pen.Brush), origin);
        origin.Offset(0, 7.0D);
      }
    }
Ejemplo n.º 20
0
        protected override void OnRender(DrawingContext dc)
        {

            Size size = new Size(base.ActualWidth, base.ActualHeight);
            int tickCount = (int)((this.Maximum - this.Minimum) / this.TickFrequency) + 1;
            if ((this.Maximum - this.Minimum) % this.TickFrequency == 0)
                tickCount -= 1;
            Double tickFrequencySize;
            // Calculate tick's setting
            tickFrequencySize = (size.Width * this.TickFrequency / (this.Maximum - this.Minimum));
            string text = "";
            FormattedText formattedText = null;
            double num = this.Maximum - this.Minimum;
            int i = 0;
            // Draw each tick text
            for (i = 0; i <= tickCount; i++)
            {
                text = Convert.ToString(Convert.ToInt32(this.Minimum + this.TickFrequency * i), 10);
                //g.DrawString(text, font, brush, drawRect.Left + tickFrequencySize * i, drawRect.Top + drawRect.Height/2, stringFormat);

                formattedText = new FormattedText(text, CultureInfo.GetCultureInfo("ru-Ru"), FlowDirection.LeftToRight, new Typeface("Arial"), 8, Brushes.Black);
                dc.DrawText(formattedText, new Point((tickFrequencySize * i), 30));

            }
        }
        protected override void OnRender(System.Windows.Media.DrawingContext dc)
        {
            RotateTransform RT = new RotateTransform();

            RT.Angle = -90;
            double        num           = this.Maximum - this.Minimum;
            double        y             = this.ReservedSpace * 0.5;
            FormattedText formattedText = null;
            double        x             = 0;

            for (double i = 0; i <= num; i += this.TickFrequency)
            {
                formattedText = new FormattedText(i.ToString(), System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Verdana"), 8, Brushes.Black, 1);
                if (this.Minimum == i)
                {
                    x = 0;
                }
                else
                {
                    x += this.ActualWidth / (num / this.TickFrequency);
                }

                dc.PushTransform(RT);
                dc.DrawText(formattedText, new Point(-20, x));
                dc.Pop();
            }
        }
Ejemplo n.º 22
0
        void RenderSelectedScopes(System.Windows.Media.DrawingContext drawingContext)
        {
            foreach (SelectedScope scope in selectedScopes)
            {
                if (Math.Abs(scope.Start - scope.Finish) < 1e-6)
                {
                    continue;
                }

                double pos0 = Math.Min(scope.Start, scope.Finish);
                double pos1 = Math.Max(scope.Start, scope.Finish);

                double posStart  = TimeLineToDrawSpace(pos0);
                double posFinish = TimeLineToDrawSpace(pos1);

                //drawingContext.DrawRectangle(Brushes.Gray, selectionScopePen, new Rect(new Point(posStart, HeaderHeight), new Point(posFinish, Extent.Height)));

                double midHeight = Extent.Height / 2;

                Rect area = new Rect(new Point(posStart, HeaderHeight), new Point(posFinish, Extent.Height));
                drawingContext.DrawRectangle(selectionScopeBackground, null, area);

                drawingContext.DrawLine(selectionScopePen, new Point(posStart, HeaderHeight), new Point(posStart, Extent.Height));
                drawingContext.DrawLine(selectionScopePen, new Point(posFinish, HeaderHeight), new Point(posFinish, Extent.Height));

                FormattedText durationText = new FormattedText(String.Format("{0:0.000}ms", pos1 - pos0).Replace(',', '.'), culture, FlowDirection.LeftToRight, fontDuration, 18, Brushes.White);
                durationText.MaxTextWidth = area.Width;
                durationText.Trimming     = TextTrimming.None;
                durationText.MaxLineCount = 1;
                drawingContext.DrawText(durationText, new Point((posStart + posFinish) / 2 - durationText.Width / 2, (Extent.Height + HeaderHeight) / 2 - durationText.Height / 2));
            }
        }
Ejemplo n.º 23
0
        void BuildFaceModel( DrawingContext dc )
        {
            if ( produced ) {
                FormattedText completed_msg = new FormattedText( "Status : Completed", CultureInfo.GetCultureInfo( "ja-JP" ), FlowDirection.LeftToRight, new Typeface( "Georgia" ), 25, Brushes.Green );
                dc.DrawText( completed_msg, new Point( 50, 50 ) );
                return;
            }
            if ( faceModelBuilder == null ) {
                return;
            }
            FaceModelBuilderCollectionStatus collection;
            collection = faceModelBuilder.CollectionStatus;
            if ( collection == 0 ) {
                return;
            }
            //Collection Status
            FormattedText text = new FormattedText( "Status : " + collection.ToString(), CultureInfo.GetCultureInfo( "ja-JP" ), FlowDirection.LeftToRight, new Typeface( "Georgia" ), 25, Brushes.Green );
            dc.DrawText( text, new Point( 50, 50 ) );
            String status = status2string( collection );
            text = new FormattedText( status, CultureInfo.GetCultureInfo( "ja-JP" ), FlowDirection.LeftToRight, new Typeface( "Georgia" ), 25, Brushes.Green );
            dc.DrawText( text, new Point( 50, 80 ) );

            //Capture Status
            FaceModelBuilderCaptureStatus capture;
            capture = faceModelBuilder.CaptureStatus;
            if ( capture == 0 ) {
                return;
            }
            status = status2string( capture );
            text = new FormattedText( status, CultureInfo.GetCultureInfo( "ja-JP" ), FlowDirection.LeftToRight, new Typeface( "Georgia" ), 25, Brushes.Green );
            dc.DrawText( text, new Point( 50, 110 ) );
            return;
        }
Ejemplo n.º 24
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            double        fontSize;
            Typeface      typeFace;
            TextAlignment alignment;
            FlowDirection flowDirection;
            double        padding;

            if (AdornedPasswordBox != null)
            {
                alignment     = ConvertAlignment(AdornedPasswordBox.HorizontalContentAlignment);
                flowDirection = AdornedPasswordBox.FlowDirection;
                fontSize      = AdornedPasswordBox.FontSize;
                typeFace      = AdornedPasswordBox.FontFamily.GetTypefaces().FirstOrDefault();
                padding       = 6;
            }
            else
            {
                alignment     = AdornedTextBox.ReadLocalValue(TextBox.TextAlignmentProperty) != DependencyProperty.UnsetValue ? AdornedTextBox.TextAlignment : ConvertAlignment(AdornedTextBox.HorizontalContentAlignment);
                flowDirection = AdornedTextBox.FlowDirection;
                fontSize      = AdornedTextBox.FontSize;
                typeFace      = AdornedTextBox.FontFamily.GetTypefaces().FirstOrDefault();
                padding       = 6;
            }
            var text = new System.Windows.Media.FormattedText(PlaceholderText ?? "", CultureInfo.CurrentCulture, flowDirection, typeFace, fontSize, System.Windows.Media.Brushes.LightGray)
            {
                TextAlignment = alignment
            };

            drawingContext.DrawText(text, new System.Windows.Point(padding, (RenderSize.Height - text.Height) / 2));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Creates a new System.Windows.Media.ImageSource of a specified FontAwesomeIcon and foreground System.Windows.Media.Brush.
        /// </summary>
        /// <param name="icon">The FontAwesome icon to be drawn.</param>
        /// <param name="foregroundBrush">The System.Windows.Media.Brush to be used as the foreground.</param>
        /// <returns>A new System.Windows.Media.ImageSource</returns>

        public static System.Windows.Media.ImageSource GetImageSource(int icon, System.Windows.Media.Brush foregroundBrush, double emSize = 100, double margin = 0)
        {
            string charIcon = char.ConvertFromUtf32(icon);

            if (_Typeface == null)
            {
                _Typeface = new System.Windows.Media.Typeface(FontFamily, System.Windows.FontStyles.Normal, System.Windows.FontWeights.Normal, System.Windows.FontStretches.Normal);
            }
            ;

            System.Windows.Media.DrawingVisual visual = new System.Windows.Media.DrawingVisual();

            using (System.Windows.Media.DrawingContext drawingContext = visual.RenderOpen())
            {
                FormattedText ft = new System.Windows.Media.FormattedText(
                    charIcon,
                    System.Globalization.CultureInfo.InvariantCulture,
                    System.Windows.FlowDirection.LeftToRight,
                    _Typeface, emSize - (2 * margin), foregroundBrush);

                ft.TextAlignment = System.Windows.TextAlignment.Center;

                drawingContext.DrawRectangle(null, new Pen(Brushes.Black, 0), new System.Windows.Rect(0, 0, emSize, emSize));
                drawingContext.DrawText(ft, new System.Windows.Point(emSize / 2, margin));
            };

            return(new System.Windows.Media.DrawingImage(visual.Drawing));
        }
Ejemplo n.º 26
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            lock (_text)
            {
                if (RegularFont == null || FixedWidthFont == null) return;
                foreach (var at in _text)
                {

                    FontInfo f = RegularFont;
                    if (at.DisplayInfo.Font == ZFont.FIXED_WIDTH_FONT || at.DisplayInfo.ImplementsStyle(ZStyles.FIXED_WIDTH_STYLE))
                    {
                        f = FixedWidthFont;
                    }
                    Brush b = ZColorCheck.ZColorToBrush(at.DisplayInfo.ForegroundColor, Support.ColorType.Foreground);
                    FormattedText ft = new FormattedText(at.Text,
                        System.Globalization.CultureInfo.CurrentCulture,
                        FlowDirection.LeftToRight, f.Typeface, f.PointSize, b,
                        new NumberSubstitution(), TextFormattingMode.Display);

                    if (at.DisplayInfo.ImplementsStyle(ZStyles.REVERSE_STYLE))
                    {
                        drawingContext.DrawRectangle(b, null, new Rect(at.X + 2, at.Y + 2, ft.WidthIncludingTrailingWhitespace, Math.Max(ft.Height, FontHeight)));
                        ft.SetForegroundBrush(ZColorCheck.ZColorToBrush(at.DisplayInfo.BackgroundColor, Support.ColorType.Background));
                    }
                    drawingContext.DrawText(ft, new Point(at.X + 2, at.Y + 2));
                    // Note: Offsetting positions by 2 to get everything to line up correctly
                }
            }
        }
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);
            FormattedText formattedText = formattedText = new FormattedText(
                Text,
                CultureInfo.GetCultureInfo("en-us"),
                FlowDirection.LeftToRight,
                new Typeface("Verdana"),
                ActualHeight,
                Brushes.Black);

            formattedText.TextAlignment = TextAlignment.Left;
            formattedText.MaxTextWidth  = ActualWidth - Padding.Left - Padding.Right;
            formattedText.Trimming      = TextTrimming.None;
            double step     = ActualHeight / 20;
            double fontSize = 0;

            for (double i = ActualHeight - step; i >= step; i -= step)
            {
                if (formattedText.Height <= ActualHeight - Padding.Top - Padding.Bottom)
                {
                    break;
                }
                formattedText.SetFontSize(i);
                fontSize = i;
            }
            if (fontSize > 14)
            {
                formattedText.SetFontSize(14);
            }
            formattedText.MaxTextHeight = ActualHeight;
            drawingContext.DrawText(formattedText, new Point(Padding.Left, Padding.Top));
        }
Ejemplo n.º 28
0
 protected override void OnRender(DrawingContext drawingContext)
 {
     drawingContext.DrawRectangle(brush, pen, new Rect(corner, DesiredSize));
     center = new Point((DesiredSize.Width - formattedText.Width)/2, (DesiredSize.Height - formattedText.Height)/2);
     drawingContext.DrawText(formattedText, center);
     base.OnRender(drawingContext);
 }
Ejemplo n.º 29
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            Typeface      Typeface1 = new Typeface(new FontFamily("Century"), FontStyles.Normal, FontWeights.Bold, FontStretches.Normal);
            FormattedText ft        = new FormattedText(TextUnderImage, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, Typeface1, 18, Brushes.Red, 1.0);

            drawingContext.DrawText(ft, new Point(0, 0));
        }
Ejemplo n.º 30
0
        public override void Render(DrawingContext dc, Point screenPoint)
        {
            Point dataPoint = screenPoint.ScreenToData(this.ct.Transform);
            Point dataPointZero = new Point(dataPoint.X,0.0);
            Point screenPointZero = dataPointZero.DataToScreen(this.ct.Transform);
            //const double verticalShift = 5; // px

            //dc.DrawLine(new Pen(Brushes.Black, 1), Point.Add(screenPoint, new Vector(0, 40)), screenPoint);

            double pointx = screenPointZero.X + 2;
            double pointy = screenPointZero.Y + 2;

            FormattedText textToDraw = new FormattedText(dataPoint.Y.ToString("0.000"), Thread.CurrentThread.CurrentCulture,
                   FlowDirection.LeftToRight, new Typeface("Arial"), 12, Brushes.Black);
            dc.DrawText(textToDraw, new Point(pointx, pointy));

            /*
            string svalue = dataPoint.Y.ToString("0.000");
            foreach (var s in svalue)
            {
                if (s.Equals('.'))
                    continue;
                FormattedText textToDraw = new FormattedText(s.ToString(), Thread.CurrentThread.CurrentCulture,
                    FlowDirection.LeftToRight, new Typeface("Arial"), 12, Brushes.Black);
                dc.DrawText(textToDraw, new Point(pointx,pointy));
                pointy = pointy + 10;

            }
             * */
        }
Ejemplo n.º 31
0
        public double Hor(DrawingContext dc, Target TargetA, Target TargetB ,bool show)
        {          
            //3D
            Vector3D vectorA = new Vector3D(TargetA.point3D().X - TargetB.point3D().X, TargetA.point3D().Y - TargetB.point3D().Y, TargetA.point3D().Z - TargetB.point3D().Z);
            Vector3D vectorB = new Vector3D(0, 1, 0);
            
            //2D
            //Vector3D vectorA = new Vector3D(TargetA.point2D().X - TargetB.point2D().X, TargetA.point2D().Y - TargetB.point2D().Y, 0);
            //Vector3D vectorB = new Vector3D(1, 0, 0);

            double theta = Math.Abs(Vector3D.AngleBetween(vectorA, vectorB));
            theta = 90 - theta;
            //if (TargetA.point3D().Y < TargetB.point3D().Y) theta = -theta;

            if (show)       //show angle text
            {
                dc.DrawText(new FormattedText(theta.ToString("f0"),
                CultureInfo.GetCultureInfo("en-us"),
                FlowDirection.LeftToRight,
                new Typeface("Verdana"),
                25, brushDeepSkyBlue),
                new Point(TargetB.point2D().X - 35, TargetB.point2D().Y - 35));

                dc.DrawLine(PenDeepSkyBlue, TargetA.point2D(), TargetB.point2D());    //show angle line 
                dc.DrawLine(PenDeepSkyBlue, new Point(TargetA.point2D().X, TargetB.point2D().Y), TargetB.point2D());
            }
            return theta;
        }
Ejemplo n.º 32
0
 protected override void OnRender(DrawingContext drawingContext)
 {
     base.OnRender(drawingContext);
     cent.X -= ft.Width / 2;
     cent.Y -= ft.Height / 2;
     drawingContext.DrawText(ft,cent);
 }
Ejemplo n.º 33
0
        /// <summary>
        /// any custom drawing here
        /// </summary>
        /// <param name="drawingContext"></param>
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);
            if (selectedDirection != null && hasDirection == true)
            {
                //start = DateTime.Now;



                //end = DateTime.Now;
                //delta = (int)(end - start).TotalMilliseconds;

                //FormattedText text = new FormattedText(string.Format(CultureInfo.InvariantCulture, "{0:0.0}", Zoom) + "z, " + MapProvider + ", refresh: " + counter++ + ", load: " + ElapsedMilliseconds + "ms, render: " + delta + "ms", CultureInfo.InvariantCulture, fd, tf, 20, Brushes.Blue);
                //drawingContext.DrawText(text, new Point(text.Height, text.Height));
                //text = null;


                SolidColorBrush brush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF072527"));
                FormattedText text = new FormattedText("End location: " + selectedDirection.EndAddress + ".\nStart location: " + selectedDirection.StartAddress + ".\nDistance: " + selectedDirection.Distance + ", duration: " + selectedDirection.Duration, CultureInfo.InvariantCulture, fd, tf, 20, brush);

                SolidColorBrush boxy = new SolidColorBrush(Color.FromArgb(130, 180, 180, 180));
                drawingContext.DrawRectangle(boxy, new Pen(), new Rect(new Point(text.Height, text.Height), new Point(text.Height + text.Width, text.Height * 2)));


                drawingContext.DrawText(text, new Point(text.Height, text.Height));

                text = null;
            }
        }
Ejemplo n.º 34
0
 protected override void OnRender(System.Windows.Media.DrawingContext dc)
 {
     foreach (Line line in graphics_)
     {
         if (HasNonComTrain.Count != 0)
         {
             dc.DrawLine(NonComTrainOccupy_, line.Points[0], line.Points[1]);
         }
         else
         {
             System.Windows.Point Middle = new System.Windows.Point((line.Points[0].X + line.Points[1].X) / 2, (line.Points[0].Y + line.Points[1].Y) / 2);
             if (AxleOccupy == 0)
             {
                 dc.DrawLine(AxleOccupyPen_, line.Points[0], line.Points[1]);
             }
             else
             {
                 dc.DrawLine(DefaultPen_, line.Points[0], line.Points[1]);
             }
             if (IsFrontLogicOccupy && IsLastLogicOccupy)
             {
                 dc.DrawLine(TrainOccpyPen_, line.Points[0], line.Points[1]);
             }
             else if (IsFrontLogicOccupy && !IsLastLogicOccupy)
             {
                 dc.DrawLine(TrainOccpyPen_, line.Points[0], Middle);
             }
             else if (!IsFrontLogicOccupy && IsLastLogicOccupy)
             {
                 dc.DrawLine(TrainOccpyPen_, Middle, line.Points[1]);
             }
         }
     }
     dc.DrawText(formattedName_, namePoint_);
 }
Ejemplo n.º 35
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            if (ParentMap != null)
            {
                var bounds = ParentMap.ViewportTransform.Inverse.TransformBounds(new Rect(ParentMap.RenderSize));
                var start = ParentMap.MapTransform.Transform(new Point(bounds.X, bounds.Y));
                var end = ParentMap.MapTransform.Transform(new Point(bounds.X + bounds.Width, bounds.Y + bounds.Height));
                var minSpacing = MinLineSpacing * 360d / (Math.Pow(2d, ParentMap.ZoomLevel) * TileSource.TileSize);
                var spacing = LineSpacings[LineSpacings.Length - 1];

                if (spacing >= minSpacing)
                {
                    spacing = LineSpacings.FirstOrDefault(s => s >= minSpacing);
                }

                var latLabelStart = Math.Ceiling(start.Latitude / spacing) * spacing;
                var lonLabelStart = Math.Ceiling(start.Longitude / spacing) * spacing;
                var latLabels = new List<Label>((int)((end.Latitude - latLabelStart) / spacing) + 1);
                var lonLabels = new List<Label>((int)((end.Longitude - lonLabelStart) / spacing) + 1);
                var labelFormat = spacing < 1d ? "{0} {1}°{2:00}'" : "{0} {1}°";

                for (var lat = latLabelStart; lat <= end.Latitude; lat += spacing)
                {
                    latLabels.Add(new Label(lat, new FormattedText(
                        CoordinateString(lat, labelFormat, "NS"),
                        CultureInfo.InvariantCulture, FlowDirection.LeftToRight, Typeface, FontSize, Foreground)));

                    drawingContext.DrawLine(Pen,
                        ParentMap.LocationToViewportPoint(new Location(lat, start.Longitude)),
                        ParentMap.LocationToViewportPoint(new Location(lat, end.Longitude)));
                }

                for (var lon = lonLabelStart; lon <= end.Longitude; lon += spacing)
                {
                    lonLabels.Add(new Label(lon, new FormattedText(
                        CoordinateString(Location.NormalizeLongitude(lon), labelFormat, "EW"),
                        CultureInfo.InvariantCulture, FlowDirection.LeftToRight, Typeface, FontSize, Foreground)));

                    drawingContext.DrawLine(Pen,
                        ParentMap.LocationToViewportPoint(new Location(start.Latitude, lon)),
                        ParentMap.LocationToViewportPoint(new Location(end.Latitude, lon)));
                }

                foreach (var latLabel in latLabels)
                {
                    foreach (var lonLabel in lonLabels)
                    {
                        var position = ParentMap.LocationToViewportPoint(new Location(latLabel.Position, lonLabel.Position));

                        drawingContext.PushTransform(new RotateTransform(ParentMap.Heading, position.X, position.Y));
                        drawingContext.DrawText(latLabel.Text,
                            new Point(position.X + StrokeThickness / 2d + 2d, position.Y - StrokeThickness / 2d - latLabel.Text.Height));
                        drawingContext.DrawText(lonLabel.Text,
                            new Point(position.X + StrokeThickness / 2d + 2d, position.Y + StrokeThickness / 2d));
                        drawingContext.Pop();
                    }
                }
            }
        }
Ejemplo n.º 36
0
        internal void DrawHand(HandData handData, DrawingContext drawingContext)
        {
            if (this.AnimationInProgress)
            {
                var brush = new SolidColorBrush(Color.FromArgb(this.Opacity, 255, 255, 255));
                this.CreateText((int)this.Center.X + " | " + (int)this.Center.Y + "\n" + new Random().NextDouble(), brush);
                this.CreateNumberText(handData.FingerCount.ToString(), brush);

                drawingContext.DrawText(this.text, this.Center);
                drawingContext.DrawText(this.number, new Point(this.Center.X, this.Center.Y - this.Radius - 40));
                drawingContext.DrawEllipse(null, new Pen(brush, 4), this.Center, this.Radius - 20, this.Radius - 20);
                drawingContext.DrawEllipse(null, new Pen(brush, 4), this.Center, this.Radius + 10, this.Radius + 10);
                this.DrawFingerPoints(handData, drawingContext);
                this.UpdateProgress(brush);
                drawingContext.DrawGeometry(brush, null, path.Data);
            }
        }
Ejemplo n.º 37
0
        public void DibujarTexto(SWPEditor.IU.PresentacionDocumento.Punto posicion, SWPEditor.IU.Graficos.Letra letra, SWPEditor.IU.Graficos.Brocha brocha, string texto)
        {
            Typeface      t = new Typeface(new FontFamily(letra.Familia), new FontStyle(), new FontWeight(), new FontStretch());
            FormattedText f = new FormattedText(texto, System.Globalization.CultureInfo.InvariantCulture, FlowDirection.LeftToRight, t, ObtenerMedida(letra.Tamaño),
                                                CrearBrocha(brocha));

            contexto.DrawText(f, CrearPunto(posicion));
        }
Ejemplo n.º 38
0
 public static void DrawTextCenterAligned(this FormattedText ft, DrawingContext dc, Point hCenter)
 {
     if (ft.Text.Length > 0)
     {
         double width = ft.GetFullWidth();
         dc.DrawText(ft, new Point(hCenter.X - width / 2 - ft.OverhangLeading, hCenter.Y));
     }
 }
Ejemplo n.º 39
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            Typeface      typeface = new Typeface("Times New Roman");
            FormattedText text     = new FormattedText("DataPropertyChange", CultureInfo.CurrentCulture,
                                                       FlowDirection.LeftToRight, typeface, 12, Brushes.Black);

            drawingContext.DrawText(text, new Point(0, 0));
        }
Ejemplo n.º 40
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            drawingContext.DrawRectangle(Background, null, new Rect(0, 0, this.Width, this.Height));
            var formattedText = new FormattedText(Text, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, TypeFace, FontSize, Foreground);
            drawingContext.DrawText(formattedText, new Point(0, 0));
        }
Ejemplo n.º 41
0
        /// <summary>
        /// Called to draw on screen
        /// </summary>
        /// <param name="drawingContext">The drawind context in which we can draw</param>
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            FormattedText text = new FormattedText(OverlayedText, Thread.CurrentThread.CurrentUICulture, FlowDirection.LeftToRight, Typeface, FontSize, ForeGround);

            drawingContext.DrawText(text, new Point(DesiredSize.Width / 2 - text.Width / 2, DesiredSize.Height / 2));
            drawingContext.DrawRectangle(Color, Border, new Rect(new Point(0, 0), DesiredSize));
            base.OnRender(drawingContext);
        }
Ejemplo n.º 42
0
		protected override void OnRender(DrawingContext dc)
		{
			if (GetString == null)
				return;
			string s = GetString();
			dc.DrawText(text, default(Point));
			base.OnRender(dc);
		}
Ejemplo n.º 43
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            if (Pins != null && Pins.Count > 1)
            {
                bool isHorizontal = Pins[0].CurrentAngle == 0;

                double left1, left2, gap;

                List<PinLine> orderedPins = Pins.SortPins(isHorizontal);

                double offset = 0;

                for (int i = 0; i < orderedPins.Count-1; i++)
                {
                    if( i+1 >= orderedPins.Count ) break;

                    left1 = isHorizontal? Canvas.GetLeft(orderedPins[i]): Canvas.GetTop(orderedPins[i]);
                    left2 = isHorizontal ? Canvas.GetLeft(orderedPins[i + 1]) : Canvas.GetTop(orderedPins[i+1]);

                    Pen BlackPen = new Pen(new SolidColorBrush(orderedPins[i].Color), 1.5);

                    gap = left2 - left1;

                    FormattedText ft = new FormattedText(gap.ToString(), CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Arial"), DipHelper.PtToDip(8), BlackPen.Brush);

                    if (isHorizontal)
                    {
                        drawingContext.DrawLine(BlackPen, new Point(left1 - offset, 20), new Point(left2 - offset, 20));

                        if (left2 - left1 - ft.Width > 0) drawingContext.DrawText(ft, new Point((left2 - left1 - ft.Width) / 2 + left1 - offset, 0));
                        else drawingContext.DrawText(ft, new Point(left1 - offset, 0));
                    }
                    else
                    {
                        drawingContext.DrawLine(BlackPen, new Point(20, left1 - offset), new Point(20, left2 - offset));

                        if (left2 - left1 - ft.Width > 0) drawingContext.DrawText(ft, new Point(20,(left2 - left1 - ft.Width) / 2 + left1 - offset));
                        else drawingContext.DrawText(ft, new Point(20, left1 - offset));
                    }
                }

            }
        }
 // Number ������Ƽ�� �����ִ� OnRender
 protected override void OnRender(DrawingContext dc)
 {
     dc.DrawText(
         new FormattedText(Number.ToString(),
                 CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                 new Typeface("Times New Roman"), 12,
                 SystemColors.WindowTextBrush),
         new Point(0, 0));
 }
Ejemplo n.º 45
0
		protected override void OnRender(DrawingContext drawingContext)
		{
			FormattedText ft = new FormattedText(Text, new CultureInfo("ru-ru"), FlowDirection.LeftToRight,
			   new Typeface(new FontFamily("Arial"), FontStyles.Normal,
			   FontWeights.Bold, new FontStretch()), TextHeight,
			   new SolidColorBrush(TextColor));
			drawingContext.DrawText(ft, new Point(X, Y));
			//base.OnRender(drawingContext);
		}
Ejemplo n.º 46
0
        protected override void OnRender(System.Windows.Media.DrawingContext dc)
        {
            base.OnRender(dc);


            if (this.playground == null)
            {
                return;
            }

            var xlength = this.playground.GetLength(1);
            var ylength = this.playground.GetLength(0);


            if (ylength == 0 || xlength == 0)
            {
                return;
            }

            double cellHeight = ActualHeight / xlength;
            double cellWidth  = ActualWidth / ylength;


            cellHeight = Math.Floor(cellHeight);
            cellWidth  = Math.Floor(cellWidth);

            if (cellHeight == 0 || cellWidth == 0)
            {
                FormattedText text = new FormattedText("Auflösung falsch gewählt", CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface("Arial"), 12, Brushes.Black);
                dc.DrawText(text, new Point(25, 25));
                return;
            }

            for (int x = 0; x < ylength; x++)
            {
                for (int y = 0; y < xlength; y++)
                {
                    var rect = new Rect(x * cellWidth, y * cellHeight, cellWidth, cellHeight);
                    if (this.playground[x, y] == true)
                    {
                        dc.DrawRectangle(Brushes.Blue, new Pen(), rect);
                    }
                }
            }

            for (int x = 0; x <= ylength; x++)
            {
                var drawingWidth = ylength * cellWidth;
                dc.DrawLine(new Pen(Brushes.LightGray, 1), new Point(0, x * cellHeight), new Point(drawingWidth, x * cellHeight));
            }

            for (int y = 0; y <= xlength; y++)
            {
                var drawingLength = xlength * cellHeight;
                dc.DrawLine(new Pen(Brushes.LightGray, 1), new Point(y * cellWidth, 0), new Point(y * cellWidth, drawingLength));
            }
        }
Ejemplo n.º 47
0
        /// <summary>
        /// Draw the object
        /// </summary>
        /// <param name="dc">DrawingContext to use to draw.</param>
        /// <param name="hAxis">The horizontal axis to draw against.</param>
        /// <param name="vAxis">The vertical axis to draw against.</param>
        public void Draw(System.Windows.Media.DrawingContext dc, HorizontalPhysicalAxis hAxis, VerticalPhysicalAxis vAxis)
        {
            Point physicalPosition = new Point(
                hAxis.WorldToPhysical(_worldPosition.X, ClippingType.Clip),
                vAxis.WorldToPhysical(_worldPosition.Y, ClippingType.Clip)
                );

            dc.DrawText(_formattedText, physicalPosition);
        }
Ejemplo n.º 48
0
 protected override void OnRender(DrawingContext drawingContext)
 {
     base.OnRender(drawingContext);
     string text = string.Format("{0} Units in {1} Packages", analysis.UnitCount, analysis.PackageCount);
     var tabControl = (TabControl)AdornedElement;
     var font = new Typeface(tabControl.FontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
     var formattedText = new FormattedText(text, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, font, tabControl.FontSize, Brushes.Black);
     var position = new Point(tabControl.ActualWidth - formattedText.WidthIncludingTrailingWhitespace - 40, 3);
     drawingContext.DrawText(formattedText, position);
 }
Ejemplo n.º 49
0
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     drawingContext.DrawRectangle(background, new Pen(Brushes.White, 1), new Rect(new Point(0, 0), DesiredSize));
     drawingContext.DrawText(new FormattedText(this.Message, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight,
                                               new Typeface("SegoeUI"),
                                               20.0,
                                               foreground),
                             new Point(10, 10));
     base.OnRender(drawingContext);
 }
Ejemplo n.º 50
0
        /// <summary>
        /// Draw the legend item
        /// </summary>
        /// <param name="dc">DrawingContext on which to draw</param>
        /// <param name="position">The position on the drawing context to draw relative to.</param>
        public override void Draw(System.Windows.Media.DrawingContext dc, System.Windows.Point position)
        {
            Pen linePen = new Pen(_stroke, _strokeThickness);

            dc.DrawLine(
                linePen,
                new Point(position.X + 2, (int)(position.Y + Dimensions.Height / 2.0)),
                new Point(position.X + 2 + 28, (int)(position.Y + Dimensions.Height / 2.0)));
            dc.DrawText(_formattedText, new Point(38 + position.X, 2 + position.Y));
        }
Ejemplo n.º 51
0
        protected override void OnRender(DrawingContext ctx)
        {
            double y = 0;

            foreach (var lineInfo in this.lineInfos)
            {
                double x = 0;
                int index = 0;
                FormattedText text = null;

                // Draw line number.
                string format = string.Format("{{0,{0}}} ", Math.Round(Math.Log10(lineInfos.Length) + 1, MidpointRounding.AwayFromZero));
                text = GetFormatText(string.Format(format, lineInfo.LineNumber + 1), LineNumberForeground);
                double w = text.WidthIncludingTrailingWhitespace;
                ctx.DrawRectangle(LineNumberBackground, null, new Rect(new Point(x, y), new Size(w, LineHeight)));
                ctx.DrawText(text, new Point(x, y));
                x += w;

                // Draw for each segment.
                foreach (var seg in lineInfo.Segments)
                {
                    if (seg.StartIndex != index)
                    {
                        text = GetFormatText(lineInfo.TextLine.Substring(index, seg.StartIndex - index), DefaultForeground);
                        ctx.DrawText(text, new Point(x, y));
                        x += text.WidthIncludingTrailingWhitespace;
                    }

                    text = GetFormatText(lineInfo.TextLine.Substring(seg.StartIndex, seg.Length), seg.Foreground);
                    ctx.DrawText(text, new Point(x, y));
                    x += text.WidthIncludingTrailingWhitespace;
                    index = seg.StartIndex + seg.Length;
                }

                if (lineInfo.TextLine.Length != index)
                {
                    text = GetFormatText(lineInfo.TextLine.Substring(index, lineInfo.TextLine.Length - index), DefaultForeground);
                    ctx.DrawText(text, new Point(x, y));
                }

                y += LineHeight;
            }
        }
        // Draws text surrounded by a rectangle.
        void BoxText(DrawingContext dc, FormattedText formtxt, 
                                        double width, Point pt)
        {
            Pen pen = new Pen(SystemColors.MenuTextBrush, 1);

            dc.DrawRectangle(null, pen,
                new Rect(pt.X, pt.Y, width + 4, formtxt.Height + 4));
            double X = pt.X + (width - formtxt.Width) / 2;
            dc.DrawText(formtxt, new Point(X + 2, pt.Y + 2));
        }
Ejemplo n.º 53
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            double textMaxWidth = 0;
            double textX        = ActualWidth;

            switch (TextAlignment)
            {
            case TextAlignment.Left:
                textX = 0;
                break;

            case TextAlignment.Center:
                textX = ActualWidth / 2;
                break;

            case TextAlignment.Right:
                textX = ActualWidth;
                break;
            }

            if (TickRenderMode == TickRenderMode.Text || TickRenderMode == TickRenderMode.Both)
            {
                foreach (double value in Ticks)
                {
                    double y = CalculateY(value);

                    FormattedText text = new FormattedText(value.ToString(), CultureInfo.CurrentUICulture,
                                                           FlowDirection.LeftToRight, new Typeface("Tahoma"), 8.0d, Fill)
                    {
                        TextAlignment = TextAlignment
                    };
                    drawingContext.DrawText(text, new Point(textX, y - text.Height / 2));
                    textMaxWidth = Math.Max(textMaxWidth, text.Width);
                }

                textMaxWidth += 3;
            }

            if (TickRenderMode == TickRenderMode.Tick || TickRenderMode == TickRenderMode.Both)
            {
                Pen pen = new Pen(Fill, 1.0d);

                GuidelineSet guidelineSet = new GuidelineSet();
                drawingContext.PushGuidelineSet(guidelineSet);

                foreach (double value in Ticks)
                {
                    double y = CalculateY(value) + 1;
                    drawingContext.DrawLine(pen, new Point(0, y), new Point(ActualWidth - textMaxWidth, y));
                    guidelineSet.GuidelinesY.Add(y - 0.5);
                }

                drawingContext.Pop();
            }
        }
Ejemplo n.º 54
0
        protected override void OnRender(System.Windows.Media.DrawingContext dc)
        {
            base.OnRender(dc);
            var bgColor = Color.FromRgb(0xF9, 0xF9, 0xF9);

            dc.DrawRectangle(new SolidColorBrush(bgColor), null, new Rect(0, 0, ActualWidth, ActualHeight));
            var text = new FormattedText("ABC l 123 Gfijdr", CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface("Arial"), 12, Brushes.Black);

            dc.DrawText(text, new Point(0, 0));
            dc.DrawLine(new Pen(Brushes.Black, 1), new Point(0.5, 10.5), new Point(50.5, 10.5));
            dc.DrawLine(new Pen(Brushes.Black, 1), new Point(30.5, 0.5), new Point(30.5, 40.5));
        }
Ejemplo n.º 55
0
        public static void DrawText(System.Windows.Media.DrawingContext dc, FormattedText text, double x, double y, bool background = true)
        {
            System.Windows.Media.Brush brush = new SolidColorBrush(
                System.Windows.Media.Color.FromArgb(190, 255, 255, 255));
            int pad = 1;

            //Draw semi transparent rectangle behind text
            Rect size = new Rect(x - pad, y - pad, text.Width + 2 * pad, text.Height + 2 * pad);

            dc.DrawRoundedRectangle(brush, new System.Windows.Media.Pen(brush, 0), size, pad, pad);
            dc.DrawText(text, new System.Windows.Point(x, y));
        }
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            double        fontSize;
            Typeface      typeFace;
            TextAlignment alignment;
            FlowDirection flowDirection;
            bool          multiline = false;
            double        ypos = 3, xpos = 6;

            if (AdornedPasswordBox != null)
            {
                alignment     = ConvertAlignment(AdornedPasswordBox.HorizontalContentAlignment);
                flowDirection = AdornedPasswordBox.FlowDirection;
                fontSize      = AdornedPasswordBox.FontSize;
                typeFace      = AdornedPasswordBox.FontFamily.GetTypefaces().FirstOrDefault();
            }
            else if (AdornedTextBox != null)
            {
                multiline     = AdornedTextBox.AcceptsReturn;
                alignment     = AdornedTextBox.ReadLocalValue(TextBox.TextAlignmentProperty) != DependencyProperty.UnsetValue ? AdornedTextBox.TextAlignment : ConvertAlignment(AdornedTextBox.HorizontalContentAlignment);
                flowDirection = AdornedTextBox.FlowDirection;
                fontSize      = AdornedTextBox.FontSize;
                typeFace      = AdornedTextBox.FontFamily.GetTypefaces().FirstOrDefault();
            }
            else
            {
                alignment     = ConvertAlignment(AdornedComboBox.HorizontalContentAlignment);
                flowDirection = AdornedComboBox.FlowDirection;
                fontSize      = AdornedComboBox.FontSize;
                typeFace      = AdornedComboBox.FontFamily.GetTypefaces().FirstOrDefault();
            }
            var text = new System.Windows.Media.FormattedText(PlaceholderText ?? "", CultureInfo.CurrentCulture, flowDirection, typeFace, fontSize, System.Windows.Media.Brushes.LightGray);


            if (!multiline)
            {
                ypos = (RenderSize.Height - text.Height) / 2;
            }

            switch (alignment)
            {
            case TextAlignment.Center:
                xpos = (RenderSize.Width - text.Width) * 0.5;
                break;

            case TextAlignment.Right:
                xpos = (RenderSize.Width - text.Width) - 6;
                break;
            }

            drawingContext.DrawText(text, new System.Windows.Point(xpos, ypos));
        }
Ejemplo n.º 57
0
            protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
            {
                base.OnRender(drawingContext);
                var text = new FormattedText(
                    this.text,
                    System.Globalization.CultureInfo.CurrentCulture,
                    System.Windows.FlowDirection.LeftToRight,
                    new System.Windows.Media.Typeface(fontFamily),
                    fontSize,
                    foreground);

                drawingContext.DrawText(text, new Point(5, 3));
            }
Ejemplo n.º 58
0
        /// <summary>
        /// Renders the current line numbers to the margin.
        /// </summary>
        /// <param name="drawingContext">The current drawing context used to write line numbers</param>
        /// <history>
        /// [Curtis_Beard]		04/08/2015	ADD: update RichTextBox to AvalonEdit
        /// </history>
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            TextView textView   = this.TextView;
            Size     renderSize = this.RenderSize;

            if (textView != null && textView.VisualLinesValid)
            {
                var foreground      = (Brush)GetValue(Control.ForegroundProperty); // non-match line
                var matchForeground = (Brush)GetValue(Control.BackgroundProperty); // match line

                foreach (VisualLine line in textView.VisualLines)
                {
                    int  lineNumber = line.FirstDocumentLine.LineNumber;
                    bool isMatch    = false;
                    if (LineNumbers != null)
                    {
                        // all line numbers are specified
                        if (LineNumbers.Count == this.Document.LineCount)
                        {
                            lineNumber = -1;

                            if (line.FirstDocumentLine.LineNumber - 1 < LineNumbers.Count)
                            {
                                lineNumber = LineNumbers[line.FirstDocumentLine.LineNumber - 1].Number;
                                isMatch    = LineNumbers[line.FirstDocumentLine.LineNumber - 1].HasMatch;
                            }
                        }
                        else
                        {
                            // look for only a given line number since not all are specified
                            LineNumber lineNum = (from n in LineNumbers where n.Number == line.FirstDocumentLine.LineNumber select n).FirstOrDefault();
                            if (lineNum != null)
                            {
                                lineNumber = lineNum.Number;
                                isMatch    = lineNum.HasMatch;
                            }
                        }
                    }

                    FormattedText text = CreateFormattedText(
                        this,
                        lineNumber > -1
                     ? lineNumber.ToString(CultureInfo.CurrentCulture)
                     : string.Empty,
                        typeface, emSize, isMatch ? matchForeground : foreground
                        );
                    drawingContext.DrawText(text, new Point(renderSize.Width - text.Width,
                                                            line.VisualTop - textView.VerticalOffset));
                }
            }
        }
Ejemplo n.º 59
0
            protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
            {
                base.OnRender(drawingContext);
#pragma warning disable CS0618 // Type or member is obsolete
                var text = new FormattedText(
                    _text,
                    System.Globalization.CultureInfo.CurrentCulture,
                    FlowDirection.LeftToRight,
                    new Typeface(_fontFamily),
                    _fontSize,
                    _foreground);
#pragma warning restore CS0618 // Type or member is obsolete

                drawingContext.DrawText(text, new Point(3, 3));
            }
Ejemplo n.º 60
0
        public void DrawText(string text, string fontName, double size, SolidColor color, Rectangle rect, ReoGridHorAlign halign, ReoGridVerAlign valign)
        {
            if (rect.Width > 0 && rect.Height > 0 && !string.IsNullOrEmpty(text))
            {
                FormattedText ft = new FormattedText(text, System.Threading.Thread.CurrentThread.CurrentCulture,
                                                     FlowDirection.LeftToRight, this.resourceManager.GetTypeface(fontName),
                                                     size * PlatformUtility.GetDPI() / 72.0,
                                                     this.resourceManager.GetBrush(color));

                ft.MaxTextWidth  = rect.Width;
                ft.MaxTextHeight = rect.Height;

                switch (halign)
                {
                default:
                    break;

                case ReoGridHorAlign.Left:
                    ft.TextAlignment = TextAlignment.Left;
                    break;

                case ReoGridHorAlign.Center:
                    ft.TextAlignment = TextAlignment.Center;
                    break;

                case ReoGridHorAlign.Right:
                    ft.TextAlignment = TextAlignment.Right;
                    break;
                }

                switch (valign)
                {
                default:
                    break;

                case ReoGridVerAlign.Middle:
                    rect.Y += (rect.Height - ft.Height) / 2;
                    break;

                case ReoGridVerAlign.Bottom:
                    rect.Y += (rect.Height - ft.Height);
                    break;
                }

                g.DrawText(ft, rect.Location);
            }
        }