I gave it a quick try, adding some buttons, and was a bit surprised there was no feedback when you pressed a button.
The Rollover indication and mousedown indication are the same, so nothing appears to happen when you press the button.
So, I added a line to do the standard shift down and to the right one pixel in the mouse down state.
In the OnPaint override sub of the ButterscotchButton class added the indicated (<=====) TranslateTransform line
<edit> I checked a "regular" winform button and noticed it doesn't do the button shift to indicate selection. It just changes to a slightly darker background color.
I guess the code should be changed to draw a darker gradientBrush for mousedown, rather then do the transformTranslate (although I didn't think the movement looked all that bad).
</edit>
Code:
Case MouseState.Down
Dim buttonrectdown As New LinearGradientBrush(innerrect, Color.FromArgb(48, 43, 39), Color.FromArgb(100, 90, 80), LinearGradientMode.Vertical)
g.TranslateTransform(1, 1) '<===== Indicate button press by shifting button down and right one pixel
g.FillPath(New SolidBrush(Color.FromArgb(26, 25, 21)), RoundRect(rect, 3))
g.FillPath(buttonrectdown, RoundRect(innerrect, 3))
g.DrawString(Text, btnfont, Brushes.White, innerrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
p.s. Also noticed that the order of action in the toggle button and radio button's OnClick event processing are out of order.
It is common in the application level Click event of radio and checkbox controls to check the current state of the control. The new state of the control, as a result of clicking on the control is set before the user gets the click event.
In the Butterscotch controls, the new state was set after the application level click event was generated, so you are looking at the previous state in the click event, not the current state.
For example, the Toggle button code was
Code:
Protected Overrides Sub OnClick(ByVal e As EventArgs)
MyBase.OnClick(e)
If Not Checked Then Checked = True Else Checked = False
End Sub
Calling the default processing, MyBase.OnClick(e), before doing the local processing is the issue.
So I changed the code to:
Code:
Protected Overrides Sub OnClick(ByVal e As EventArgs)
Checked = Not Checked
MyBase.OnClick(e)
End Sub
Now the Checked state gets toggled before the default processing is done, so is already changed when the user gets the Click Event.
Also, since we're just toggling a boolean, got rid of the If Then Else statement and just toggle the boolean.