Exemplo n.º 1
0
        /// <inheritdoc />
        public override void OnRender(IDrawingContext context,
                                      Themes.Color backColor,
                                      Themes.Color foreColor,
                                      MainMenu mainMenu,
                                      int itemAreaWidth)
        {
            var firstArea = $"{(Checked ? Application.Environment.GetCheckStateChar(CheckState.Checked) : ' ')}";

            context.DrawText(firstArea, backColor, foreColor);

            var textContentLength = mainMenu.DrawMenuItem(this, context, backColor, foreColor);

            if (ShowShortcut && !Items.Any())
            {
                var shortcutText = Shortcut?.ToString() ?? string.Empty;
                context.DrawText((shortcutText + " ")
                                 .PadLeft(itemAreaWidth - firstArea.Length - textContentLength -
                                          (Text.IndexOf('&') > -1 ? 0 : 2)),
                                 backColor,
                                 foreColor);
            }
            if (Items.Any())
            {
                context.DrawText(Application.Environment.MenuSubItemsMarker
                                 .ToString()
                                 .PadLeft(itemAreaWidth - firstArea.Length - textContentLength - (Text.IndexOf('&') > -1 ? 0 : 2)),
                                 backColor,
                                 foreColor);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Filling a pseudographics drawing context
 /// </summary>
 public abstract void OnRender(IDrawingContext context,
                               Themes.Color backColor,
                               Themes.Color foreColor,
                               MainMenu mainMenu,
                               int itemAreaWidth);