.NET Compact Framework Programming with Visual Basic .NET

Book description

“For nearly two decades, Paul Yao and David Durant have been acknowledged as experts on the Windows platform, so it’s only natural that they would bring their experienced point of view to the .NET Compact Framework. With a unique combination of historical perspective and in-depth understanding of the subject matter, Yao and Durant take the reader through not only the technical guts of the Compact Framework but also the reasons behind the design decisions.”

—Joshua Trupin, Executive Editor, MSDN Magazine

“Yao and Durant have written a book that, although it assumes no prior experience with the .NET Framework, serves both the rookie and advanced programmer equally well. This is definitely a rare quality among technical books and is certainly not an easy thing for an author to accomplish.”

—Doug Holland, Precision Objects

“This is a very good hands-on book with plenty of sample code illustrating programming tasks and techniques, which any serious development effort for Windows CE or Pocket PC will require.”

—Bill Draper, Director of Software Development

“This book serves as both a great reference and tutorial when building .NET Compact Framework applications. My only wish is that it had been available sooner.”

—Greg Hack, Senior Software Engineer, Allscripts Healthcare Solutions

“Of the handful of books on Compact Framework, this book takes the cake. Paul Yao and David Durant’s expertise with .NET Compact Framework is evident from their excellent and very insightful coverage of sections such as Building the User Interface, Managing Device Data, and Creating Graphical Output. The chapter discussing the topic of P/Invoke is unparalleled. After reviewing this book, I am certain that if there is one book that will help you understand .NET Compact Framework, this is the one.”

—Deepak Sharma, Senior Systems Specialist, Tata Infotech Ltd.

“Yao and Durant’s fresh, innovative, and in-depth look at the .NET Compact Framework gets developers up to speed using C# to develop robust and scaleable handheld software solutions. A definite must-read for mobile handheld developer enthusiasts!”

—Andrew Krowczyk, Software Architect, Zurich North America

.NET Compact Framework Programming with Visual Basic .NET is the definitive tutorial and reference for the .NET Compact Framework (CF). It shows you how to transfer your skills and your code to the Pocket PC 2003 and other mobile and embedded smart devices.

Authors Paul Yao and David Durant draw upon their years of research and experience with members of the Microsoft .NET CF team to show you exactly how the best CF programming gets done in Visual Basic .NET. This is the only book a programmer needs to master the art of CF coding. Throughout the book, sample code and examples illustrate best practices and programming techniques. In addition, the companion Web site includes downloadable code for all these examples, along with a set of development tools to help you with your CF development projects.

The authors expertly zero in on what programmers need to understand for successful smart device programming, including:

  • Garbage Collection in the .NET Compact Framework

  • Controls and supported Properties, Methods, and Events (PMEs)

  • Custom controls with Windows Forms Designer support

  • Using Platform Invoke (P/Invoke)

  • Simple and complex data binding and the DataGrid control

  • Programming with ADO.NET data classes

  • Synchronizing SQL Server CE with SQL Server 2000 databases

  • Creating graphical output, including font and printing coding tricks

  • Differences between the standard desktop framework and the CF

  • .NET Compact Framework Programming with Visual Basic .NET is your single resource for everything you really need to know about CF programming.



    Table of contents

    1. Copyright
      1. Dedication
    2. Praise for .NET Compact Framework Programming with Visual Basic .NET
    3. Microsoft .NET Development Series
      1. Titles in the Series
    4. Foreword
    5. Preface
      1. What You Need to Use This Book
        1. Hardware
        2. Software
        3. The Latest Version of the .NET Compact Framework
      2. The Target Audience for This Book
        1. For Programmers Experienced with Windows CE
        2. For Programmers Experienced with the .NET Framework
    6. Acknowledgments
    7. About the Authors
    8. I. Foundations
      1. 1. .NET Compact Framework Architecture
        1. Windows CE Overview
          1. Design Goals
            1. Small
            2. Modular
            3. Portable
            4. Compatible
            5. Connected
            6. Real Time
          2. Platforms and Platform Builder
          3. eMbedded Visual C++
            1. Remote Tools
            2. Documentation
            3. Obtaining eMbedded Visual C++
        2. What Is .NET?
          1. Available .NET Implementations
          2. The Scale and Scope of .NET
            1. The Scale of .NET
            2. The Scope of .NET
          3. Three .NET Application Classes
            1. Windows Forms and Web Forms
            2. Web Services
          4. Common Programming Elements
            1. Well-Designed Programming Interface
            2. Common Intermediate Language
            3. Common Language Runtime
            4. Common Language Specification
            5. Common Type System
            6. Common Language Infrastructure
        3. The .NET Compact Framework
          1. Design Goals
            1. Build on the Benefits of the .NET Framework
            2. Maintain Consistency with the Desktop Version
            3. Ensure That the Framework Runs Well on Mobile and Embedded Devices
            4. Expose the Richness of Target Platforms
            5. Preserve the Look and Feel of Platforms
            6. Provide Portability to Other Mobile Operating Systems
          2. .NET Compact Framework Files
          3. .NET Compact Framework Capabilities
            1. Supported Runtime Elements
            2. Supported .NET Application Classes
            3. Graphical Output
            4. Supported ADO.NET Elements
            5. XML Support
          4. .NET Compact Framework Limitations
        4. CONCLUSION
      2. 2. What Is a .NET Compact Framework Program?
        1. The Essence of a .NET Compact Framework Program
          1. Uses the .NET Compact Framework Libraries
          2. Has a Graphical User Interface
          3. Is Defined Entirely in Source Code
          4. Has One or More Classes Derived from System.Windows.Forms.Form
        2. Using Visual Studio .NET 2003
          1. Using the Development Environment
          2. Examining Designer-Generated Code
          3. Regions
        3. The Cistern Sample Program
          1. Step 1: Adding Controls Using the Designer
          2. Step 2: Adding Code to the Program
            1. Adding a New Form to an Application
            2. Understanding Events and Event Handlers
            3. Creating and Displaying a Second Form
            4. Creating Controls at Runtime
        4. Adding Classes
          1. Creating the WaterMath Classes
          2. Overloading Functions
          3. Using the WaterMath Object
          4. Defining and Using Shared Methods
          5. Understanding Namespaces
          6. Using IntelliSense
        5. CONCLUSION
      3. 3. The .NET Type System
        1. Using Type Information: Namespace References and Assembly References
          1. Namespace Contents
          2. Accessing Namespaces
          3. Assembly References
        2. Standard Types
          1. Value Types
            1. Integer and Floating-Point Value Types
            2. Data Structures
          2. Reference Types
          3. Declaration, Initialization, and Allocation
          4. Value Types and Reference Types as Parameters
            1. Value Types as Parameters
            2. Reference Types as Parameters
        3. Strings
          1. Literal Strings
          2. The System.String Class
            1. String Properties, Methods, and Operators
            2. Value Type or Reference Type?
            3. Strings Are Immutable
            4. The Other Side of Immutability
          3. The System.Text.StringBuilder Class
          4. String Resources
        4. Type Conversion
          1. Numeric Conversion
            1. Explicit Conversion
            2. The Overflow Exception
            3. Handling Exceptions
            4. Converting Strings to Numbers
          2. String Conversion
            1. Numeric Formatting
            2. Character Set Conversion
            3. Creating Formatted Strings
          3. Converting Values to Objects
        5. Memory Management
          1. Metadata Maps
          2. The JITted Code Pool
          3. Garbage Collector Pools
          4. Garbage Collection and Data
          5. Automatic Garbage Collection
            1. Phase 1: Mark and Sweep
            2. Phase 2: Compact the Heap
            3. Phase 3: Flush the JITted Code Pool
          6. Special Handling of Managed Data
            1. Calling the Garbage Collector
            2. Manual Cleanup Using the Dispose Method
            3. Implementing Class-Specific Cleanup Methods: Dispose and Finalize
            4. Weak References
          7. Manual Memory Management of Native Data
        6. CONCLUSION
      4. 4. Platform Invoke
        1. Overview of P/Invoke
          1. When to Use P/Invoke
          2. Why We Prefer .NET Compact Framework Classes over Win32 Functions
          3. Porting Unmanaged Code to Managed Code
        2. Creating P/Invoke Declarations
          1. A Simple Function: MessageBox
          2. Unmanaged Function Details
          3. Function Return Values
          4. Getting Started: C-Style Function Declarations
        3. Supported P/Invoke Function Parameters
          1. The Limits of Parameter Passing
          2. Simple Data Types
            1. Boolean
            2. Signed versus Unsigned Integers
          3. Passing Parameters by Value versus by Reference
          4. Passing String Parameters by Value
          5. Structures
            1. Example: MemoryStatus
          6. Type of Types versus Type of Parameters
            1. Value Types as Parameters
            2. Reference Types as Parameters
          7. Arrays
            1. Example: Passing an Array of Integers
        4. A Sample Program: CallWin32
        5. Writing Win32 Dynamic Link Libraries
          1. Development Tools
          2. Declaring C++ Functions in a DLL
        6. Manual P/Invoke Parameter Passing
          1. The Marshal Class
          2. Allocating Unmanaged Memory
          3. Copying to Unmanaged Memory
          4. Creating Objects from Unmanaged Memory
            1. Example: FindMemoryCard
        7. Communicating between Unmanaged and Managed Code
          1. The MessageWindow Class
          2. Other Ways to Communicate between Unmanaged and Managed Code
        8. Comparing P/Invoke Support
          1. Windows CE–Specific Differences
          2. Limitations
            1. No Support for COM Interop
            2. No Support for Callback Functions
            3. No Support for the StructLayout Attribute
            4. No Support for the MarshalAs Attribute
          3. .NET Compact Framework Implementation Details
        9. CONCLUSION
    9. II. Building the User Interface
      1. 5. Creating Forms
        1. What Are Forms?
          1. Deriving Forms from the Form Class
          2. Properties, Methods, and Events
            1. Properties
            2. Methods
            3. Events
          3. An Event-Capturing Application
        2. Manipulating Forms
          1. Creating Forms
          2. Displaying Forms
          3. Closing Forms
          4. Orphaned Forms
          5. The Weather Sample Application
          6. Tracking Forms
          7. The Controls Collection
          8. Multithreading
        3. Inheritance and Visual Inheritance
        4. CONCLUSION
      2. 6. Mouse and Keyboard Input
        1. Overview of Input
          1. Event-Driven Input
            1. The Foreground Window
            2. Enabled versus Disabled
            3. Visibility
            4. Keyboard Input
            5. Mouse Input
          2. Using Controls for Mouse and Keyboard Input
            1. Control Support for Input Events
            2. Input to Label Controls
          3. Carets and Cursors
        2. Programming for Mouse Input
          1. Mouse Events
            1. Automatic Mouse Capture
            2. Mouse Event Handlers
          2. A Sample Program: DrawRectangles
            1. Drawing Stretchable Rubber Rectangles
            2. Collecting the Points
            3. Drawing the Rectangles
            4. Mouse Debugging Tip: Echoing Mouse Coordinates as Text
          3. Setting the Mouse Cursor with the Cursor Class
          4. Setting the Mouse Cursor with Win32 Functions
        3. Programming for Keyboard Input
          1. Sources of Keyboard Input
            1. Device Buttons
            2. Software Input Panel
            3. Keyboards
            4. The Win32 keybd_event Function
          2. Keyboard Events
            1. Focus Events
            2. Activation Events
            3. Keyboard Event Sequences
              1. Printable Character Keys
              2. Nonprintable Keys
              3. Pocket PC Device Buttons
            4. Keyboard Event Handlers
          3. A Sample Program: KeyInput
            1. Responding to SIP Changes by Using the InputPanel Control
            2. Subclassing versus Event Handlers
            3. Subclassing a TextBox Control
            4. Subclassing and the Windows Forms Designer
            5. Identifying Methods to Override
          4. A Sample Program: KeyState
          5. A Sample Program: Caret
            1. Creating and Destroying a Caret
            2. Moving a Caret
          6. A Sample Program: Sleep
            1. Pushing the Power Button
            2. Reading and Writing System Timeout Values
        4. CONCLUSION
      3. 7. Inside Controls
        1. What Are Controls?
          1. Visible Objects
          2. Descended from the Desktop .NET Framework
            1. Maintain Consistency with the Desktop Version
            2. Ensure That the Framework Runs Well on Mobile and Embedded Devices
            3. Expose the Richness of Target Platforms
            4. Preserve the Look and Feel of Platforms
          3. Documentation, Development, and Confusion
        2. Categories of Controls
          1. The Ultimate Parent Controls
          2. The Container Controls
          3. The Single-Item Controls
          4. The Multi-Item Controls
          5. The Command Input Controls
          6. The Visual Numeric Value Controls
          7. The Background Controls
        3. Properties, Methods, and Events
        4. The Core Events
          1. The Disposed Event
          2. The ParentChanged Event
          3. The Validating and Validated Events
          4. The EnabledChanged Event
          5. The GotFocus and LostFocus Events
        5. The Core Properties
          1. The Parent/Child Properties
          2. The Positional Properties
          3. The Data-Binding Properties
          4. The Control State Properties
        6. The Core Methods
          1. Thread-Safe Function Calls
          2. Object Cleanup
          3. Coordinate Conversion
          4. Z-Ordering
          5. Visibility
        7. Working with Control Type Information
          1. Typecasting Controls
          2. Comparing Two Control References
          3. Checking a Control's Type
        8. Five Commonly Used Controls
        9. A Sample Program: TimeTracker
          1. Writing the Code
          2. The Application Interface
          3. Coding Event Handlers
        10. The Label Control
          1. Display, Yes; Update, No
          2. Transparency
        11. The TextBox Control
          1. Display, Yes; Input, Yes
        12. The ListBox and ComboBox Controls
          1. The List in ListBox Controls
          2. Using the ComboBox Control in the Sample Application
        13. The Button Control
          1. Triggering Actions
          2. Adding a Control at Runtime
          3. Handling the Click Event for the New Button
          4. Handling the Click Event for the Add Button
          5. Handling the Click Event for the Cancel Button
        14. The RadioButton and CheckBox Controls
          1. A Sample Program: RegisterMembers
          2. Using Radio Buttons
          3. Building RegisterMembers
          4. Using Check Boxes
          5. Improving RegisterMembers
        15. CONCLUSION
      4. 8. Data Binding to Controls
        1. Data Binding
          1. Data-Bindable Controls
          2. Data-Bindable Objects
        2. Complex Data Binding
          1. Using Complex Data Binding with ListBox and ComboBox Controls
        3. Simple Data Binding
          1. The BindingsCollection Property
          2. Formatting and Parsing
        4. The DataGrid Control
          1. Using Complex Data Binding with the DataGrid Control
          2. Styling the Display of Data in a DataGrid Control
          3. Creating Table and Column Styles
          4. Creating Styles at Runtime
          5. Responding to User Input
          6. Using Simple Data Binding with the DataGrid Control
          7. Accessing DataGrid Information
          8. Providing Drill-Down Capability
          9. Providing In-Place Editing Capability
          10. Providing Automated In-Place Editing Capability
        5. CONCLUSION
      5. 9. Inside More Controls
        1. Detecting Support for Properties, Methods, and Events
          1. A Tool: ControlPME
          2. .NET Compact Framework Controls in a Desktop .NET Framework Program
        2. Menus
          1. The Start Menu
          2. Program Menus
          3. A Sample Program: ProgramMenu
          4. Context Menus
          5. A Sample Program: TextBoxClipboard
            1. The Context Menu
            2. Clipboard Support in a TextBox Control
        3. Grabbing Events
          1. Subclassing to Intercept Win32 Messages
          2. Getting Messages into Managed Code by Using the MessageWindow Class
        4. The ToolBar and ImageList Controls
          1. Toolbars
          2. Toolbar Buttons
          3. ImageList Controls and Images
          4. A Sample Program: ToolBar
        5. Dialog Boxes
          1. Built-in Dialog Boxes
          2. A Sample Program: FileDialogs
          3. Creating Custom Dialog Boxes
            1. Designing Pocket PC Dialog Boxes
            2. Programming Custom Dialog Boxes
            3. Fixing a Pocket PC Task List Problem
          4. A Sample Program: DialogBoxes
            1. Creating the Options Dialog Box
            2. Controlling the Options Dialog Box
        6. CONCLUSION
      6. 10. Building Custom Controls
        1. Custom Controls
        2. Controls as Objects
          1. Design Recommendations
            1. Most Controls Are Wrappers around Native Windows Classes
            2. The Possible Base Classes for Your Custom Control
            3. The Foundation of All Controls Are PMEs
            4. “Inherited Does Not Mean Supported”
            5. Consider Using Context Menus in Custom Controls
            6. The Methods for Testing Controls
          2. About Properties and Methods
            1. Properties Are Executable Code and Can Be Overridden Just Like Methods
            2. Overriding a Method or Property to Replace the Base Class Method
            3. You Can Supplement a Method or Property Instead of Replacing It
            4. A Private Version of a Method or Property “Shadows” the Base Class Method
            5. To Extend a Method, Call the Base Class Method
            6. Hardware Input Bypasses Property Accessors
          3. About Events
            1. You Cannot Override Events, but You Can Override the Methods That Raise Events
            2. Custom Control Classes Can Either Respond to Events or Override the Base Event Handler
            3. The OnLostFocus Method Raises Three Events: Validating, Validated, and LostFocus
        3. Deriving Custom Controls from an Existing .NET Control
          1. The DateBox Control Example
            1. Design Decision #1: Exposing Custom Control Content
            2. Design Decision #2: Where to Validate/Filter Incoming Data
            3. The DateBox Code
              1. The Date Property
              2. The Text Property
              3. The MinValue and MaxValue Properties
              4. The Format Property
              5. The Default Constructor
              6. The Validating Event Handler
              7. The Context Menu Routines
            4. Testing the DateBox Control
          2. The WaterTemp Object Example
            1. More Design Decisions
            2. The WaterTemp Object
            3. The WaterBox Object
        4. Creating Composite Controls
          1. The TaskStatus Control Example
            1. Programming for the Relationship between Components
        5. Creating New Controls
          1. Design Tips
            1. Custom Controls Support More Events Than Built-in Controls
            2. You Can Override the Drawing Only for Controls Directly Derived from Control
            3. A Redrawing Can Be Requested by the Runtime or Initiated by the Application
            4. Drawing in a Custom Control
          2. Providing Our Own Display for the TaskStatus Control
        6. Adding Animation to a Custom Control
          1. The Game of Life
          2. Providing Consistent Speed and Minimal Flicker
          3. Object Reuse
        7. Authoring Custom Controls for the Multithreaded Environment
          1. A Control's Main Thread and Its Service Threads
          2. The Multithread Example
            1. The Testing Form
            2. The Custom Control
        8. Adding a Custom Control to the Visual Studio .NET Toolbox
          1. Obstacles to Putting Custom Controls in the Toolbox
            1. A .NET Compact Framework Control Cannot Be Added to the Toolbox
            2. You Are Developing a Desktop Control That Is Different from a Normal Desktop Control
            3. You See Build Errors
            4. Testing Design-Time Controls Takes a Bit More Effort
            5. Freeze Version Numbers during Testing
            6. One or Two Sets of Source Files?
          2. Developing a Design-Time Custom Control
            1. The Setup Process for a Design-Time Control Project
            2. The Development Process for a Design-Time Control Project
            3. An Example of Setting Up a Project with the DateBox Custom Control
            4. Building and Installing the Design-Time DateBox Control
            5. Setting Default Property Values
        9. CONCLUSION
    10. III. Managing Device Data
      1. 11. Storage
        1. Smart-Device Data Storage
          1. The Object Store
            1. System Power States
            2. Installable File Systems
          2. The Windows CE File System
          3. ROM-Based Files
          4. RAM-Based Files
        2. File I/O
          1. The File and Directory Classes
          2. Byte-Level I/O
          3. Higher-Level I/O
          4. Encoding and Decoding Data
          5. Using the I/O Classes
          6. Text File I/O
          7. Binary File I/O
          8. Writing Binary Data
          9. Reading Binary Data
          10. I/O and Structures
          11. XML File I/O
        3. Registry Access
          1. Opening a Registry Key
          2. The Need for P/Invoke Wrappers
          3. Mapping Registry Types to Managed Types
          4. Opening and Accessing Registry Keys
          5. Reading Registry Values
          6. Writing Registry Values
          7. Using Function Overloading for Registry Access
          8. Using Registry Utility Classes
          9. Updating the Storage Sample Application to Use the Registry
        4. CONCLUSION
      2. 12. ADO.NET Programming
        1. Examining ADO.NET
          1. A Layered Approach
          2. The ADO.NET Classes
            1. Namespace References and Assembly References
            2. Functionality: Super Sets and Subsets
          3. ADO.NET Error Handling
        2. Working with Data Sets
          1. Creating and Accessing DataSet, DataTable, and DataView Objects
            1. Understanding Data Tables
            2. Working with Data Rows
            3. Introducing Data Views
          2. Data Binding
            1. Binding to Multi-Item Controls
            2. Binding to Single-Item Controls
            3. Designating the Row to Be Displayed
              1. Matching Binding
              2. Indexing
              3. Search Key
            4. Assigning the Controls to a Row
            5. Updating the Bound Data Table
          3. Reading and Writing a Data Set as XML
        3. Microsoft SQL Server CE
          1. SQL Server CE Files
          2. SQL Server CE Syntax
          3. SQL Server CE Query Analyzer
          4. Creating a SQL Server CE Database
          5. Populating a SQL Server CE Database
            1. The SqlCeConnection and SqlCeCommand Classes
          6. Retrieving and Displaying Data
            1. The SqlCeDataReader Class
          7. Updating a SQL Server CE Database
          8. The SqlCeDataAdapter Class
            1. Using a SqlCeDataAdapter Object to Retrieve Data
            2. Using a SqlCeDataAdapter Object to Update a Database
          9. Querying Schema Information
        4. Microsoft SQL Server
          1. Connecting to SQL Server
          2. Creating Command Objects
          3. Using SQL Server Stored Procedures
          4. Using Stored Procedures with DataSet Objects
          5. DataSet Objects and Concurrency
        5. Web Services
          1. XML, XSD, and SOAP
          2. A Web Services Application
          3. A Web Services Client Application
        6. CONCLUSION
      3. 13. Synchronizing Mobile Data
        1. Understanding Remote Data Applications
          1. RDA and Merge Replication
          2. IIS Connectivity
          3. Database Connectivity
        2. Installing Remote Data Connectivity
          1. Creating the Virtual Directory
          2. Configuring Additional Components
        3. Using RDA
          1. RDA Capabilities and Overhead
          2. Programming for RDA
            1. Pulling Data
            2. Fixing the IDENTITY Property
            3. Viewing the Pulled Schema
            4. Modifying Pulled Data Locally
            5. Pushing Data
            6. The SubmitSQL Method
        4. Using Merge Replication
          1. Using Good Design to Avoid Synchronization Failures
          2. Configuring Merge Replication
          3. Programming for Merge Replication
            1. Subscribing to a Publication
            2. Synchronizing the Data
            3. Modifying the Data at the Device
        5. Choosing between Merge Replication and RDA
        6. CONCLUSION
      4. 14. The Remote API
        1. What Is ActiveSync?
          1. Partners and Guests
          2. ActiveSync Limitations
            1. Only One Active Connection
            2. No Emulator Support
            3. No Synchronization between Devices
            4. No Synchronization with Servers
          3. ActiveSync Compared with Web Services
          4. ActiveSync Programming Interfaces
          5. Should You Build Managed-Code ActiveSync Applications?
        2. RAPI Fundamentals
          1. Available RAPI Functions
          2. Building .NET ActiveSync Applications
          3. RAPI Startup and Shutdown
            1. CeRapiInit versus CeRapiInitEx
            2. Shutdown with CeRapiUninit
            3. Two Approaches to Startup
              1. Approach 1: Simple, Single-Threaded RAPI Startup
              2. Approach 2: Multithreaded RAPI Startup
            4. Defensive Coding
        3. Accessing the Object Store
          1. Using RAPI to Access Device Files
            1. FindPrograms: Using RAPI to Find Files in the Device File System
            2. FindProgramsFaster: Speeding Up a File Search
          2. Remote Access to Device Registry Entries
          3. Remote Access to Device Property Databases
        4. Detecting Changes in Device Connection State
          1. The Auto-Start Approach
          2. The Callback Approach
        5. Loading Programs and DLLs
          1. Running Device-Side Programs
          2. Loading Device-Side DLLs
            1. Building a DLL Using eMbedded Visual C++
            2. Calling a DLL Function with CeRapiInvoke
        6. CONCLUSION
    11. IV. Creating Graphical Output
      1. 15. .NET Compact Framework Graphics
        1. An Introduction to .NET Compact Framework Graphics
          1. Drawing Surfaces
            1. Display Screens
            2. Printers
            3. Bitmaps
            4. Metafiles
            5. Supported Drawing Surfaces
          2. Drawing Function Families
            1. Text Output
            2. Raster Output
            3. Vector Output
          3. .NET Compact Framework Graphics
            1. The Role of the Graphics Class
            2. Drawing Support for Text Output
            3. Drawing Support for Raster Output
            4. Drawing Support for Vector Output
        2. Drawing on the Display Screen
          1. Accessing a Graphics Object
          2. Drawing in Controls
          3. The Paint Event
          4. Non–Paint Event Drawing
        3. Raster Graphics
          1. Specifying Colors
            1. System Colors
            2. Named Colors
            3. Colors from RGB Values
          2. Creating Brushes
            1. Creating Brushes with System Colors
            2. Creating Brushes with Named Colors
            3. Creating Brushes with RGB Values
          3. Creating Bitmaps
            1. Bitmaps: Drawing Surface or Drawing Object?
            2. The Bitmap Class
            3. Creating an Empty Bitmap
            4. Creating a Bitmap from an External File
            5. Creating a Bitmap from a Resource
              1. Typed Resources
              2. Untyped Resources
            6. Image File Sizes
          4. Drawing Bitmaps
            1. Drawing the Entire Bitmap at the Original Image Size
            2. Drawing Part of a Bitmap at the Original Image Size
            3. Drawing Part of a Bitmap with a Change to the Image Size
            4. Drawing Part of a Bitmap with a Change to the Image Size and with Transparency
          5. A Sample Program: ShowBitmap
        4. Vector Graphics
          1. Creating Pens
          2. A Game: JaspersDots
        5. CONCLUSION
      2. 16. Text and Fonts
        1. Drawing Text
          1. Text-Drawing Support in the .NET Compact Framework
          2. The DrawString Method
          3. A Sample Program: SimpleDrawString
        2. Font Selection
          1. The Font Property of Controls
          2. Generic Fonts
          3. A Sample Program: GenericFonts
          4. Creating Named Fonts
          5. Enumerating Fonts
          6. A Sample Program: FontPicker
          7. A Sample Library: FontList, a Win32 Font Enumeration DLL
          8. Native-Code Fonts
            1. Creating Fonts in Unmanaged Code
            2. Drawing with Fonts in Unmanaged Code
            3. Cleanup
          9. A Sample Program: RotateText
        3. Placing Text
          1. Text Size and the MeasureString Method
          2. A Sample Program: MeasureString
          3. Text Alignment
          4. A Sample Program: TextAlign
          5. Word Wrap
          6. A Sample Program: WordWrap
        4. Text Color
          1. Foreground and Background Text Colors
          2. A Sample Program: TextColor
        5. CONCLUSION
      3. 17. Printing
        1. The Printing Pipeline
          1. Printer
            1. Page Description Languages (PDLs)
              1. PCL
              2. Postscript
          2. I/O Channel
          3. Print Job
          4. Graphics Subsystem
          5. Printing Program
        2. Programming for Printed Output
          1. Overview of Printing Sample Programs
            1. Timing Tests for the Sample Printing Programs
            2. Our Results
          2. Pocket PC Printing Support
          3. The Print Dialog Box
        3. Direct Printing
          1. Direct Printing to a PCL Printer
          2. A Sample Program: PrintDirect
        4. Rendering with GDI
          1. GDI Design Notes
            1. Device-Independent Logical Drawing Model
            2. Device-Independent Programming Interface
          2. Windows CE Support for GDI Functions
            1. GDI Query Functions
            2. GDI Printing and Drawing Functions
            3. GDI Drawing Attributes
          3. A Sample Program: PrintGDI
        5. HP Mobile Printing
          1. HP Mobile Printing for Pocket PC
          2. HP Mobile Printing Software Development Kits
            1. HP Mobile Printing SDK
            2. HP Mobile Printing SDK with Microsoft Visual Studio .NET Support
          3. A Sample Program: PrintHPMobile
        6. Rendering with PrinterCE
          1. The PrinterCE Library
          2. A Sample Program: PrintField
        7. CONCLUSION
    12. V. Appendixes
      1. A. Hungarian Notation for .NET Programs
        1. Goals and Objectives
        2. Guidelines
        3. .NET Naming Guidelines
        4. Hungarian Notation
          1. Our Use of Hungarian Notation
          2. The m_ Prefix for Private Data
          3. Hungarian Prefixes for CTS Value Types
      2. B. Supported PMEs for .NET Compact Framework Controls
      3. C. Data Synchronization Wizards
        1. The Virtual Directory Creation Wizard
        2. The Create Publication Wizard
      4. D. Windows API Allocation and Cleanup Functions
      5. Glossary

    Product information

    • Title: .NET Compact Framework Programming with Visual Basic .NET
    • Author(s): Paul Yao, David Durant
    • Release date: June 2004
    • Publisher(s): Addison-Wesley Professional
    • ISBN: 0321174046