Chapter 13. Controls and Graphics: Make it pretty

image with no caption

Sometimes you have to take graphics into your own hands.

We’ve spent a lot of time relying on controls to handle everything visual in our applications. But sometimes that’s not enough—like when you want to animate a picture. And once you get into animation, you’ll end up creating your own controls for your .NET programs, maybe adding a little double buffering, and even drawing directly onto your forms. It all begins with the Graphics object, bitmaps, and a determination to not accept the graphics status quo.

You’ve been using controls all along to interact with your programs

TextBoxes, PictureBoxes, Labels...you’ve got a pretty good handle by now on how you can use the controls in the IDE’s toolbox. But what do you really know about them? There’s a lot more to a control than just dragging an icon onto your form.

  • You can create your own controls

    The controls in the toolbox are really useful for building forms and applications, but there’s nothing magical about them. They’re just classes, like the classes that you’ve been writing on your own. In fact, C# makes it really easy for you to create controls yourself, just by inheriting from the right base class.

  • Your custom controls show up in the IDE’s toolbox

    There’s also nothing mysterious about the toolbox in the IDE. It just looks in your project’s classes and the built-in .NET classes for any ...

Get Head First C#, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.