Example #1
0
        /// <summary>
        /// Draw item.
        /// </summary>
        public override async Task Draw()
        {
            base.Draw();

            string caption = CurrentListItem;
            float  offset  = ScreenTools.GetTextWidth(caption, _itemText.Font, _itemText.Scale);

            _itemText.Color = Enabled ? Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148);

            _itemText.Caption = caption;

            _arrowLeft.Color  = Enabled ? Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148);
            _arrowRight.Color = Enabled ? Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148);

            _arrowLeft.Position = new PointF(375 - (int)offset + Offset.X + Parent.WidthOffset, _arrowLeft.Position.Y);
            if (Selected)
            {
                _arrowLeft.Draw();
                _arrowRight.Draw();
                _itemText.Position = new PointF(403 + Offset.X + Parent.WidthOffset, _itemText.Position.Y);
            }
            else
            {
                _itemText.Position = new PointF(418 + Offset.X + Parent.WidthOffset, _itemText.Position.Y);
            }
            _itemText.Draw();
        }
Example #2
0
 public static float MeasureString(string input, Font font, float scale) => ScreenTools.GetTextWidth(input, font, scale);
Example #3
0
 public static int MeasureString(string input) => (int)ScreenTools.GetTextWidth(input, Font.ChaletLondon, 1f);
Example #4
0
 public static float MeasureStringWidthNoConvert(string str, Font font, float scale) => ScreenTools.GetTextWidth(str, font, scale);