O'Reilly logo

Delphi for .NET Developer’s Guide by Xavier Pacheco

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

User Painting: The PlayingCard Control

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required