Example #1
0
        internal static RichLabel TextBold(this RichLabel label, String text, SystemDrawing.Color color = default(SystemDrawing.Color))
        {
            color = color == SystemDrawing.Color.Empty ? SystemDrawing.Color.Black : color;
            if (Globals.Style.BoldFont == null)
            {
                Globals.Style.BoldFont = new Font(label.Skin.Renderer, Configs.RegularBoldFontName, 16);
            }
            var measure = label.Skin.Renderer.MeasureText(Globals.Style.BoldFont, text);
            int?width = null, height = null;

            if (measure.X > label.Width)
            {
                width = label.Width + measure.X;
            }
            if (measure.Y > label.Height)
            {
                height = label.Height + measure.Y;
            }
            if (width.HasValue || height.HasValue)
            {
                label.SetSize(width.HasValue ? width.Value : label.Width, height.HasValue ? height.Value : label.Height);
            }
            label.Text(text, color, Globals.Style.BoldFont);
            return(label);
        }
Example #2
0
 internal static RichLabel Text(this RichLabel label, String text, SystemDrawing.Color color = default(SystemDrawing.Color))
 {
     color = color == SystemDrawing.Color.Empty ? SystemDrawing.Color.Black : color;
     if (Globals.Style.RegularFont == null)
     {
         Globals.Style.RegularFont = new Font(label.Skin.Renderer, Configs.FontName, 16);
     }
     label.Text(text, color, Globals.Style.RegularFont);
     return(label);
 }