GDI+ Programming : Creating Custom Controls Using C#
by White, Eric; Garrett, Chris; Robinson, SimonRent Book
New Book
We're Sorry
Sold Out
Used Book
We're Sorry
Sold Out
eBook
We're Sorry
Not Available
How Marketplace Works:
- This item is offered by an independent seller and not shipped from our warehouse
- Item details like edition and cover design may differ from our description; see seller's comments before ordering.
- Sellers much confirm and ship within two business days; otherwise, the order will be cancelled and refunded.
- Marketplace purchases cannot be returned to eCampus.com. Contact the seller directly for inquiries; if no response within two days, contact customer service.
- Additional shipping costs apply to Marketplace purchases. Review shipping costs at checkout.
Summary
Table of Contents
| Introduction | p. 1 |
| Who is this Book For? | p. 2 |
| What Does this Book Cover? | p. 2 |
| What You Need to Use this Book | p. 4 |
| Style Conventions | p. 5 |
| Customer Support and Feedback | p. 6 |
| Source Code and Updates | p. 6 |
| Errata | p. 6 |
| Technical Support | p. 7 |
| p2p.wrox.com | p. 7 |
| An Overview of GDI+ and Custom Controls | p. 11 |
| GDI+ and .NET | p. 12 |
| What is GDI+? | p. 13 |
| The GDI+ Namespaces | p. 16 |
| Custom Controls | p. 17 |
| Building Windows Forms Custom Controls | p. 17 |
| Web Forms Custom Controls | p. 18 |
| Creating Generic Code for both Windows Forms and Web Forms | p. 20 |
| A First Example | p. 20 |
| Summary | p. 35 |
| Drawing Surfaces | p. 37 |
| Drawing Surfaces | p. 38 |
| Raster-based and Vector-based Drawing Surfaces | p. 38 |
| The Characteristics of a Drawing Surface | p. 39 |
| The Color Structure | p. 41 |
| Drawing Surfaces in Different Environments | p. 44 |
| A Summary of Drawing Surfaces | p. 46 |
| The Graphics Class | p. 47 |
| The GDI+ Coordinate System | p. 51 |
| Summary | p. 62 |
| Pens and Brushes | p. 65 |
| Drawing with the Pen Object | p. 66 |
| Controlling Properties of the Pen | p. 67 |
| The Pens Class | p. 75 |
| Filling with the Brush Object | p. 76 |
| Using the Brush Classes | p. 76 |
| The Brushes Class | p. 90 |
| Creating a Pen from a Brush | p. 90 |
| A Note about Performance | p. 91 |
| Summary | p. 92 |
| Text and Fonts | p. 95 |
| An Overview of Text and Fonts | p. 96 |
| Working with Fonts in GDI+ | p. 97 |
| Drawing Basic Text | p. 101 |
| Formatting Text | p. 103 |
| Font Styles | p. 104 |
| Lines, Alignment, and Orientation | p. 105 |
| Dealing with Fonts | p. 114 |
| Finding Available Fonts | p. 114 |
| Font Metrics and Precision Text Placement | p. 115 |
| Quality of Text | p. 121 |
| Summary | p. 127 |
| Images | p. 131 |
| An Overview of Image Handling | p. 132 |
| The Image, Bitmap, and Metafile Classes | p. 132 |
| Different Types of Bitmap | p. 135 |
| Encoders and Decoders | p. 136 |
| Pixel Format | p. 138 |
| Displaying Images | p. 141 |
| Checking the Size and Resolution | p. 142 |
| Changing the Resolution of a Bitmap | p. 145 |
| Image Resizing and Interpolation | p. 146 |
| Manipulating Images | p. 148 |
| Cropping an Image | p. 148 |
| Skewing, Reflecting, and Rotating an Image | p. 149 |
| Cloning an Image | p. 151 |
| Getting a Thumbnail of an Image | p. 152 |
| Creating and Drawing into an Image | p. 153 |
| Creating a New Bitmap | p. 153 |
| Double-buffering | p. 156 |
| Working with Alpha in Images | p. 157 |
| Getting and Setting Pixels | p. 160 |
| Setting Alpha for an Entire Image | p. 162 |
| Playing an Animation | p. 165 |
| Converting a BMP to a JPEG | p. 167 |
| Summary | p. 169 |
| GraphicsPaths and Regions | p. 171 |
| What are GraphicsPaths and Regions? | p. 171 |
| The GraphicsPath Class | p. 172 |
| The Region Class | p. 181 |
| Summary | p. 187 |
| Clipping and Invalidation | p. 191 |
| The Clipping Region | p. 192 |
| Cropping with the Clipping Region | p. 192 |
| Selective Repainting with the Clipping Region | p. 198 |
| Clipping at the Pixel Level | p. 207 |
| Invalidation | p. 209 |
| Using State in our Control | p. 209 |
| How Invalidation Works | p. 210 |
| A Few Clipping Tips | p. 214 |
| Summary | p. 215 |
| Transformations | p. 219 |
| Transformations in GDI+ | p. 219 |
| Coordinate Systems and Transformations | p. 221 |
| World Transformations | p. 222 |
| Invalidation and Clipping | p. 235 |
| Transformations and Custom Controls | p. 236 |
| Summary | p. 236 |
| Printing | p. 239 |
| The Printing Process | p. 240 |
| The Printing-related Classes in GDI+ | p. 241 |
| How is a Document Printed or Print-previewed? | p. 242 |
| Using the Printing Classes | p. 243 |
| A Simple Printing Example | p. 244 |
| Selecting the Unit of Measurement | p. 254 |
| Default Graphics Units | p. 255 |
| The Ruler Printing Example | p. 256 |
| Printing Metrics | p. 258 |
| Displaying Printing Metrics | p. 260 |
| Controlling the Printer Drawing Surface | p. 262 |
| Where the User Changes the Settings | p. 266 |
| Summary | p. 267 |
| An Alternative Coordinate System | p. 271 |
| Defining the Problem | p. 272 |
| The Outline Model Coordinate System | p. 276 |
| The GraphicsOM Class | p. 276 |
| Creating a 3D Effect | p. 282 |
| Summary | p. 286 |
| Architecture and Design of Windows Forms Custom Controls | p. 289 |
| Basic Principles | p. 290 |
| What is a Component? | p. 291 |
| What is a Custom Control? | p. 294 |
| Building a Windows Forms Custom Control | p. 295 |
| The Simple Custom Control Sample | p. 295 |
| Using a Custom Control | p. 297 |
| Creating a Test Application | p. 299 |
| Adding Properties to our Custom Control | p. 301 |
| Custom Control with Properties Example | p. 301 |
| Creating a Test Application | p. 305 |
| Default Values of Properties | p. 306 |
| Custom Control with Default Property Values Sample | p. 306 |
| Focus | p. 310 |
| Focus Cues | p. 310 |
| Steps to Implement a Focusable Control | p. 311 |
| Focusable Control Example | p. 312 |
| Creating a Test Application | p. 320 |
| Generating Events | p. 322 |
| Overview of Delegates and Events | p. 322 |
| Events Example | p. 323 |
| Create a Test Application | p. 326 |
| Deriving from an Existing Control | p. 327 |
| NumberTextBox Example | p. 327 |
| Creating the Control | p. 328 |
| Creating a Test Application | p. 332 |
| Composite Custom Controls | p. 333 |
| DataButtons Example | p. 334 |
| Create a Test Application | p. 336 |
| Designing Components and Custom Controls | p. 337 |
| Advantages of Non-Procedural Constructs | p. 338 |
| Designing Components Using this Philosophy | p. 339 |
| Designing Events | p. 340 |
| Summary | p. 340 |
| Design-Time Support | p. 343 |
| Basic Concepts | p. 343 |
| Editing Properties in the Properties Window | p. 344 |
| Editing the Control in the Design View | p. 346 |
| Categorizing Properties and Events | p. 347 |
| Improved Editing in the Properties Window | p. 348 |
| The NumberRange Struct | p. 350 |
| The TypeConverter-Derived Class | p. 351 |
| The NumberTextBoxA Control | p. 356 |
| Creating a Test Application | p. 358 |
| Debugging Design-Time Code | p. 358 |
| Creating a Modal Dialog Box Property Editor | p. 359 |
| The NumberTextBoxB Control | p. 360 |
| The NumberRangeDialog | p. 361 |
| The NumberRangeEditor | p. 363 |
| Creating a Test Application | p. 366 |
| Creating a Drop-Down Property Editor | p. 367 |
| The NumberRangeDropDown Control | p. 367 |
| The NumberRangeEditor | p. 371 |
| Creating a Test Application | p. 372 |
| Implementing a Custom Designer | p. 373 |
| The SimpleBlankControl | p. 374 |
| The SimpleLineControl | p. 376 |
| Summary | p. 382 |
| Scrolling | p. 385 |
| Building a Scrolling Sample | p. 386 |
| Setting the Scrollbar Position | p. 387 |
| Drawing in a Viewport | p. 388 |
| Scrolling Techniques | p. 389 |
| Which Approach do I Use? | p. 390 |
| Placing a Non-Scrollable Control in a Panel | p. 392 |
| Smooth Scrolling | p. 393 |
| The SmoothScrollableControl Sample | p. 393 |
| Testing the Control | p. 400 |
| Summary | p. 401 |
| Mouse Events and Cursors | p. 403 |
| Mouse Events | p. 404 |
| Mouse Cursors | p. 405 |
| Standard Mouse Cursors | p. 406 |
| The CursorsExample | p. 406 |
| Custom Mouse Cursors | p. 408 |
| Hit Testing and Drawing During Mouse Events | p. 409 |
| The HitTestExample | p. 410 |
| Mouse Event Routing | p. 414 |
| The RoutingMouseEvents Sample | p. 415 |
| Handling the CaptureChanged Event | p. 418 |
| GDI and BitBlt | p. 421 |
| Why Use GDI? | p. 422 |
| Using BitBlt() | p. 423 |
| The Simple BitBltExample | p. 424 |
| Drawing While Dragging | p. 425 |
| The AlphaDragExample | p. 425 |
| Drag-Scrolling | p. 432 |
| Demonstrating the 'Wiggle-the-Mouse Bug' | p. 433 |
| Removing the Wiggle Bug | p. 441 |
| Summary | p. 443 |
| GDI+ Images in ASP.NET | p. 445 |
| Internet Information Services (IIS) | p. 446 |
| Documentation | p. 448 |
| Security and Virtual Directories | p. 449 |
| Reading and Serving Images | p. 450 |
| Streams | p. 452 |
| Reading an Image from a Remote Web Server | p. 453 |
| Mixing HTML and Dynamic Images | p. 455 |
| Modifying Images | p. 457 |
| Creating a New Image | p. 462 |
| Pie Charts | p. 466 |
| Summary | p. 469 |
| Creating Custom ASP.NET Server Controls | p. 471 |
| Custom Controls | p. 472 |
| Creating an ASP.NET User Control | p. 473 |
| User Control Properties | p. 475 |
| A Custom Button User Control | p. 476 |
| Creating a Thumbnail Control | p. 481 |
| Making a Thumbnail | p. 481 |
| Creating a Custom Control | p. 484 |
| Creating a Thumbnail Picture Gallery | p. 486 |
| Design-Time Support | p. 488 |
| Creating a Toolbox Icon | p. 488 |
| Other Design-Time Features | p. 489 |
| Summary | p. 490 |
| Web Services and GDI+ | p. 493 |
| What are Web Services? | p. 493 |
| How can GDI+ be used with a Web Service? | p. 494 |
| A Simple Web Service | p. 495 |
| The Hello World Web Service | p. 495 |
| Returning an Image URL | p. 498 |
| The Image URL Web Service | p. 501 |
| Returning Image Data | p. 503 |
| Summary | p. 507 |
| Index | p. 509 |
| Table of Contents provided by Syndetics. All Rights Reserved. |
An electronic version of this book is available through VitalSource.
This book is viewable on PC, Mac, iPhone, iPad, iPod Touch, and most smartphones.
By purchasing, you will be able to view this book online, as well as download it, for the chosen number of days.
Digital License
You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.
More details can be found here.
A downloadable version of this book is available through the eCampus Reader or compatible Adobe readers.
Applications are available on iOS, Android, PC, Mac, and Windows Mobile platforms.
Please view the compatibility matrix prior to purchase.