O'Reilly logo

Head First C#, 2nd Edition by Jennifer Greene, Andrew Stellman

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

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

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