/// ------------------------------------------------------------------------------------ /// <summary> /// When a mouse event occurs (click, up, move) update the state of the button /// </summary> /// ------------------------------------------------------------------------------------ private void UpdateOnMouseAction() { DropDownButtonState newButtonState; if (MouseOnButton) { if ((MouseButtons & MouseButtons.Left) != 0 && m_dropDown == null && !m_fDropDownClickedClose) { newButtonState = DropDownButtonState.Pressed; } else { newButtonState = DropDownButtonState.Hot; } } else { newButtonState = DropDownButtonState.Normal; } if (newButtonState != m_buttonState) { m_buttonState = newButtonState; // for some reason the button doesn't redraw immediately if we call Invalidate, // so we redraw it now. using (Graphics graphics = CreateGraphics()) { DrawDropDownButton(graphics); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// When a mouse event occurs (click, up, move) update the state of the button /// </summary> /// ------------------------------------------------------------------------------------ private void UpdateOnMouseAction() { DropDownButtonState newButtonState; if (MouseOnButton) { if ((MouseButtons & MouseButtons.Left) != 0 && m_dropDown == null && !m_fDropDownClickedClose) newButtonState = DropDownButtonState.Pressed; else newButtonState = DropDownButtonState.Hot; } else newButtonState = DropDownButtonState.Normal; if (newButtonState != m_buttonState) { m_buttonState = newButtonState; // for some reason the button doesn't redraw immediately if we call Invalidate, // so we redraw it now. using (Graphics graphics = CreateGraphics()) { DrawDropDownButton(graphics); } } }