Ejemplo n.º 1
0
 private bool SelectNextItem(RadioButtonListItem i, bool forward)
 {
     if (items.Count > 0)
     {
         var idx = -1;
         if (i != null && (idx = BaseItems.IndexOf(i)) == -1)
         {
             throw new ArgumentOutOfRangeException(nameof(i));
         }
         idx = GetNextEnabledItemIndex(idx, forward);
         if (idx != -1)
         {
             EnsureVisible(idx);
             SetSelected(idx);
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Paints the button.
        /// </summary>
        /// <param name="g">A <see cref="Graphics" /> reference.</param>
        /// <param name="index">The index of the item.</param>
        /// <param name="bounds">The bounds in which to paint the item.</param>
        protected override void PaintButton(Graphics g, int index, Rectangle bounds)
        {
            RadioButtonListItem li = BaseItems[index] as RadioButtonListItem;

            // Get current state
            System.Windows.Forms.VisualStyles.RadioButtonState curState = li.Checked ? System.Windows.Forms.VisualStyles.RadioButtonState.CheckedNormal : System.Windows.Forms.VisualStyles.RadioButtonState.UncheckedNormal;
            if (!Enabled || !li.Enabled)
            {
                curState += 3;
            }
            else if (index == PressingItem)
            {
                curState += 2;
            }
            else if (index == HoverItem)
            {
                curState++;
            }
            // Draw glyph
            Microsoft.Win32.NativeMethods.BufferedPaint.Paint <RadioButtonState, RadioButtonListItem>(g, this, bounds, PaintAnimatedButton, lastState, curState, GetTransition(curState, lastState), li);
            lastState = curState;
        }
Ejemplo n.º 3
0
        private void PaintAnimatedButton(Graphics g, Rectangle bounds, RadioButtonState curState, RadioButtonListItem li)
        {
            Point gp = li.GlyphPosition;

            gp.Offset(bounds.Location);
            RadioButtonRenderer.DrawRadioButton(g, gp, curState);
        }