/// <summary> /// Draws the item. /// </summary> /// <param name="c">The c.</param> /// <param name="g">The g.</param> /// <param name="itemSize">Size of the item.</param> /// <param name="isSelected">if set to <c>true</c> [is selected].</param> public override void DrawItem(ZeroitSideBar c, Graphics g, Size itemSize, bool isSelected) { using (var sb = new SolidBrush(isSelected ? GraphicUtils.ForegroundColorForBackground(c.ColorScheme.SecondaryColor) : ForeColor)) { using (var format = new StringFormat { LineAlignment = StringAlignment.Center, }) { g.DrawString(Text, c.Font, sb, new Rectangle(SIDE_OFFSET, 0, itemSize.Width, itemSize.Height), format); } } }
/// <summary> /// Measures the item. /// </summary> /// <param name="c">The c.</param> /// <param name="g">The g.</param> /// <param name="itemHeight">Height of the item.</param> public override void MeasureItem(ZeroitSideBar c, Graphics g, out int itemHeight) { itemHeight = Math.Max(DEFAULT_TEXT_HEIGHT, (int)g.MeasureString(Text, c.Font).Height + SIDE_OFFSET * 2); }