/// <summary>
 /// Handles the <see cref="E:RenderItem" /> event.
 /// </summary>
 /// <param name="e">The <see cref="RenderMenuItemEventArgs" /> instance containing the event data.</param>
 protected override void OnRenderItem(RenderMenuItemEventArgs e)
 {
     using (var brush = new SolidBrush(ForeColor)) {
         GraphicUtils.DrawCenteredText(
             e.Graphics,
             Text,
             e.Font,
             Rectangle.FromLTRB(e.Rectangle.Left + textOffsetLeft, e.Rectangle.Top, e.Rectangle.Right, e.Rectangle.Bottom),
             ForeColor, horizontal: false);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Handles the <see cref="E:RenderItem" /> event.
        /// </summary>
        /// <param name="e">The <see cref="RenderMenuItemEventArgs"/> instance containing the event data.</param>
        protected virtual void OnRenderItem(RenderMenuItemEventArgs e)
        {
            EventHandler <RenderMenuItemEventArgs> eh = RenderItem;

            eh?.Invoke(this, e);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Draws the item.
        /// </summary>
        /// <param name="g">The g.</param>
        /// <param name="rect">The rect.</param>
        /// <param name="font">The font.</param>
        public void DrawItem(Graphics g, Rectangle rect, Font font)
        {
            var args = new RenderMenuItemEventArgs(g, rect, font);

            OnRenderItem(args);
        }