We’ve discussed a number of controls that derive their look and feel from that of existing components. However, what if an existing control doesn’t suit your user interface needs? That’s where user painted controls come in. User painted controls allow you to have complete control over how the control is rendered onscreen.
To demonstrate, we’ll walk through the implementation of a playing card WinForm control. The card will paint the suit and value on the face of the card and a color and image of the user’s choice on the back.
To start, we’ll define a couple of enums to represent suits and values:
type CardSuit = (CSClub, CSDiamond, CSHeart, CSSpade); CardValue = (CVAce, CVTwo, CVThree, CVFour, CVFive, CVSix, ...