Exemplo n.º 1
0
 public override Rectangle MeasureBoundingBox(Control child)
 {
     return(GridInternal.MeasureBoundingBox(
                Children,
                child,
                DrawBorders,
                ActualWidth,
                ActualHeight,
                ColumnDefinitions,
                RowDefinitions,
                1,
                1));
 }
Exemplo n.º 2
0
 protected override void OnRender(DrawingContext dc)
 {
     if (DrawBorders)
     {
         GridInternal.Render(
             dc,
             Background,
             Foreground,
             FrameStyle.Single,
             Children,
             ColumnDefinitions, RowDefinitions,
             ActualWidth, ActualHeight,
             0, 0);
     }
 }
Exemplo n.º 3
0
        protected override void OnRender(DrawingContext dc)
        {
            var style     = Console.FocusedWindow == this ? FrameStyle.Double : FrameStyle.Single;
            var truncated =
                Title == null
                    ? string.Empty
                    : Title.Length + 2 > ActualWidth - 4
                          ? ActualWidth < 9
                                ? string.Empty
                                : $" {Title.Remove(ActualWidth - 9)}... "
                          : ActualWidth < 9
                                ? string.Empty
                                : $" {Title} ";

            if (!DrawBorders)
            {
                dc.DrawFrame(new Rectangle(0, 0, ActualWidth, ActualHeight),
                             new FrameOptions {
                    Background = Background, Foreground = Foreground, Style = style
                });
                dc.DrawText(new Point(2, 0), truncated, new TextOptions
                {
                    Background = Background,
                    Foreground = Foreground
                });
                return;
            }
            GridInternal.Render(
                dc, Background, Foreground, style, Children, ColumnDefinitions, RowDefinitions,
                ActualWidth, ActualHeight, 1, 1);
            dc.DrawText(new Point(2, 0), truncated, new TextOptions
            {
                Background = Background,
                Foreground = Foreground
            });
        }