Windows Forms Programming in C#
暫譯: C# 的 Windows Forms 程式設計

Chris Sells

  • 出版商: Addison Wesley
  • 出版日期: 2003-09-06
  • 售價: $2,390
  • 貴賓價: 9.5$2,271
  • 語言: 英文
  • 頁數: 736
  • 裝訂: Paperback
  • ISBN: 0321116208
  • ISBN-13: 9780321116208
  • 相關分類: C#
  • 已過版

買這商品的人也買了...

相關主題

商品描述

Programming Windows Forms in C# is the ultimate guide to using the Microsoft .NET forms package. Readers learn how to build smart client applications that take full advantage of both the rich user interface features of the Microsoft Windows operating system and the deployment features of HTML-based applications. Author Chris Sells draws upon his WinForms research and programming experience to provide what the Windows Forms documentation could not: a clear picture of exactly how C# programmers will want to use WinForms.

Well-written and easy to navigate, this book presents the building blocks of WinForms and the best practices for creating stand-alone client applications and front ends to databases and Web services. Readers gain an understanding of the rationale behind aspects of WinForms' design and will find out how to avoid or solve common problems. Figures illustrate WinForms' user interface features and code samples are used throughout the book to demonstrate best practices. All code has been tested with Visual Studio .NET 1.1 and is available at www.sellsbrothers.com, where readers will also find updates to the book.

This book focuses on the topics readers need to understand in order to build real-world applications. These topics include:

Form layout
  • Multiple top-level windows
  • Non-rectangular windows
  • Accessing data from the middle tier, filesystems, XML, databases, and Web services
  • Classes outside the System.WinForms namespace, including System.Drawing and System.Security
  • Custom drawing
  • Hosting and building controls
  • Design-time integration
  • Data binding
  • Multithreaded user interfaces
  • Deploying WinForms over the Web
  • Moving from MFC
  • Delegates and events
  • Serialization basics

Programming Windows Forms in C# is the tutorial for experienced Windows programmers who are serious about mastering Windows Forms.

Table of Contents

Figures.


Tables.


Foreword.


Preface.


1. Hello, Windows Forms.

WinForms from Scratch.

Windows Forms in Visual Studio .NET.

Arranging Controls.

Controls.

Application Settings.

Resources.

Dialogs.

Drawing and Printing.

Data Binding.

Multithreaded User Interfaces.

Deployment.

Moving from MFC.

Where Are We?



2. Forms.

Showing Forms.

Owner and Owned Forms.

Form Lifetime.

Form Size and Location.

Restricting Form Size.

Z-Order.

Form Adornments.

Form Transparency.

Nonrectangular Forms.

Form Menus.

Context Menus.

Child Controls.

Control Z-Order.

Control Tab Order.

Themed Controls.

Hosting COM Controls.

Layout.

Form Auto-Scaling.

Anchoring.

Docking.

Docking and Z-Order.

Splitting.

Grouping.

Custom Layout.

Multiple Document Interface.

Menu Merging.

Visual Inheritance.

Where Are We?



3. Dialogs.

Standard Dialogs.

Styles.

Setting Modal Versus Modeless Behavior Dynamically.

Data Exchange.

Handling OK and Cancel.

Modeless Form Data.

Data Validation.

Regular Expressions and Validation.

Data Format Notification.

Thorough Validation.

Implementing Help.

Tooltips.

Using the ErrorProvider for General Information.

Handling the Help Button and F1.

Using HTML Help.

Compiled HTML Help.

Using the HelpProvider Component.

Showing Help Contents, Index, and Search.

Where Are We?



4. Drawing Basics.

Drawing to the Screen.

Handling the Paint Event.

Triggering the Paint Event.

Colors.

Known Colors.

Color Translation.

Brushes.

Solid Brushes.

Texture Brushes.

Hatch Brushes.

Linear Gradient Brushes.

Path Gradient Brushes.

Pens.

Line Caps.

Dashes.

Alignments.

Joins.

Creating Pens from Brushes.

Shapes.

Curves.

Smoothing Modes.

Saving and Restoring Graphics Settings.

Paths.

Fill Modes.

Images.

Loading and Drawing Images.

Scaling, Clipping, Panning, and Skewing.

Rotating and Flipping.

Recoloring.

Transparency.

Animation.

Drawing to Images.

Icons.

Cursors.

Where Are We?



5. Drawing Text.

Fonts.

Creating Fonts.

Font Families.

Font Characteristics.

Font Height.

Strings.

Formatting.

Strings and Paths.

Where Are We?



6. Advanced Drawing.

Page Units.

Converting Pixels to Page Units.

Transforms.

Scaling.

Scaling Fonts.

Rotation.

Translation.

Shearing.

Combining Transforms.

Transformation Helpers.

Path Transformations.

Regions.

Constructing and Filling a Region.

Clipping to a Region.

Region Combination Operations.

Optimized Drawing.

Double Buffering.

Other Drawing Options.

Where Are We?



7. Printing.

Print Documents.

Print Controllers.

Print Preview.

Basic Print Events.

Margins.

Page Settings.

Printer Settings.

Print Range.

Targeting the Printer.

Where Are We?



8. Controls.

Standard Controls.

Action Controls.

Value Controls.

List Controls.

Container Controls.

ImageLists.

Owner-Draw Controls.

Custom Controls.

Deriving Directly from the Control Class.

Testing Custom Controls.

Control Rendering.

Ambient Properties.

Custom Functionality.

Control Input.

Windows Message Handling.

Scrolling Controls.

Extending Existing Controls.

User Controls.

Drag and Drop.

The Drop Target.

The Drop Source.

Where Are We?



9. Design-Time Integration.

Components.

Standard Components.

Custom Components.

Design-Time Integration Basics.

Hosts, Containers, and Sites.

Debugging Design-Time Functionality.

The DesignMode Property.

Attributes.

Property Browser Integration.

Code Serialization.

Batch Initialization.

Extender Property Providers.

Type Converters.

Expandable Object Converter.

UI Type Editors.

Drop-Down UI Type Editors.

Modal UI Type Editors.

Custom Designers.

Design-Time-Only Properties.

Design-Time Context Menu Verbs.

Where Are We?



10. Resources.

Resource Basics.

Manifest Resources.

Typed Resources.

Resource Manager.

Designer Resources.

Resource Localization.

Culture Information.

Resource Probing.

Resource Localization.

Resource Localization for Nondevelopers.

Resource Resolution.

Input Language.

Where Are We?



11. Applications and Settings.

Applications.

Application Lifetime.

Application Context.

Application Events.

UI Thread Exceptions.

Single-Instance Applications.

Passing Command Line Arguments.

Multi-SDI Applications.

Environment.

Compile-Time Settings.

Environment Settings.

Settings.

Types of Settings.

.config Files.

Dynamic Properties.

The Registry.

Special Folders.

Settings and Streams.

Isolated Storage.

Versioned Data Paths.

Choosing a Settings Mechanism.

Where Are We?



12. Data Sets and Designer Support.

Data Sets.

Retrieving Data.

Creating Data.

Updating Data.

Deleting Data.

Tracking Changes.

Committing Changes.

Multitable Data Sets.

Constraints

Relations.

Navigation.

Expressions.

Designer Support.

Connection Objects.

Command Objects.

Data Adapter Objects.

Typed Data Sets.

Creating a Typed Data Set.

Constraints in Typed Data Sets.

Relations in Typed Data Sets.

Expressions in Typed Data Sets.

Adding a Typed Data Set to a Form.

Where Are We?



13. Data Binding and Data Grids.

Data Binding.

Bindings and Data Sources.

Simple Data Binding to Items.

Simple Data Binding to Lists

Simple Binding to Data Sets.

Binding Managers.

Current Data Row.

Changes to the Data Set.

Changes to the Control.

Complex Data Binding.

Data Views.

Master-Detail Relations.

Data Grids.

Formatting Data Grids.

Data Exchange and Data Grids.

Bringing It All Together.

Custom Data Sources.

Custom Item Data Sources.

Type Descriptors and Data Binding.

Type Conversion.

List Data Sources.

Where Are We?



14. Multithreaded User Interfaces.

Long-Running Operations.

Progress Indication.

Asynchronous Operations.

Safety and Multithreading.

Simplified Multithreading.

Canceling.

Communication with Shared Data.

Communicating via Method Parameters.

Communication via Message Passing.

Asynchronous Web Services.

Where Are We?



15. Web Deployment.

Hosting Controls in Internet Explorer.

Control Creation.

Control Interaction.

Code Access Security.

Checking for Permissions.

Awarding Permissions.

No-Touch Deployment.

Application Download.

Versioning.

Related Files.

Partially Trusted Assembly Considerations.

Allowing Partially Trusted Callers.

Settings.

Custom User Input.

Communicating via Web Services.

Reading and Writing Files.

Command Line Arguments.

Debugging NTD Applications.

Increasing Permissions.

Increasing Permissions Programmatically.

Deploying Permissions.

Authenticode.

Where Are We?



A. Moving from MFC.

A Few Words About MFC.

MFC Versus WinForms.

The Differences.

Strategy.

Genghis.



B. Delegates and Events.

Delegates.

Events.

Harvesting All Results.

Asynchronous Notification: Fire and Forget.

Happiness in the Universe.



C. Serialization Basics.

Streams.

Formatters.

Skipping a Nonserialized Field.

IDeserializationCallback.

ISerializable.

Data Versioning.



D. Standard WinForms Components and Controls.

Components and Controls Defined.

Standard Components.

Standard Dialogs.

Notify Icons.

Timer.

Image List.

Main Menus and Context Menus.

Standard Controls.

Non-Container Controls.

Container Controls.



Bibliography.


Index. 0321116208T08272003

商品描述(中文翻譯)

使用 C# 程式設計 Windows Forms》是使用 Microsoft .NET 表單套件的終極指南。讀者將學習如何構建智能客戶端應用程式,充分利用 Microsoft Windows 作業系統的豐富用戶介面功能以及基於 HTML 的應用程式的部署功能。作者 Chris Sells 根據他的 WinForms 研究和程式設計經驗,提供了 Windows Forms 文檔無法提供的內容:C# 程式設計師希望如何使用 WinForms 的清晰圖景。

這本書寫得很好且易於導航,介紹了 WinForms 的基本構建塊以及創建獨立客戶端應用程式和數據庫及 Web 服務前端的最佳實踐。讀者將理解 WinForms 設計背後的原理,並將學會如何避免或解決常見問題。書中用圖示說明了 WinForms 的用戶介面特性,並使用代碼範例來展示最佳實踐。所有代碼均已在 Visual Studio .NET 1.1 中測試,並可在 www.sellsbrothers.com 獲得,讀者還可以在此找到書籍的更新。

本書專注於讀者需要理解的主題,以便構建實際應用程式。這些主題包括:
- 表單佈局
- 多個頂層窗口
- 非矩形窗口
- 從中間層、檔案系統、XML、數據庫和 Web 服務訪問數據
- System.WinForms 命名空間以外的類,包括 System.Drawing 和 System.Security
- 自定義繪圖
- 托管和構建控制項
- 設計時整合
- 數據綁定
- 多執行緒用戶介面
- 通過 Web 部署 WinForms
- 從 MFC 遷移
- 委託和事件
- 序列化基礎

使用 C# 程式設計 Windows Forms》是針對有經驗的 Windows 程式設計師的教程,適合那些認真掌握 Windows Forms 的讀者。

目錄
圖表。


表格。


前言。


序言。


1. 你好,Windows Forms。

從零開始的 WinForms。

在 Visual Studio .NET 中的 Windows Forms。

控制項佈局。

控制項。

應用程式設置。

資源。

對話框。

繪圖和列印。

數據綁定。

多執行緒用戶介面。

部署。

從 MFC 遷移。

我們在哪裡?



2. 表單。

顯示表單。

擁有者和被擁有的表單。

表單生命週期。

表單大小和位置。

限制表單大小。

Z-順序。

表單裝飾。

表單透明度。

非矩形表單。

表單菜單。

上下文菜單。

子控制項。

控制項 Z-順序。

控制項 Tab 順序。

主題控制項。

托管 COM 控制項。

佈局。

表單自動縮放。

錨定。

停靠。

停靠和 Z-順序。

分割。

分組。

自定義佈局。

多文檔介面。

菜單合併。

視覺繼承。

我們在哪裡?



3. 對話框。

標準對話框。

樣式。

動態設置模態與非模態行為。

數據交換。

處理確定和取消。

非模態表單數據。

數據驗證。

正則表達式和驗證。

數據格式通知。

徹底驗證。

實現幫助。

工具提示。

使用 ErrorProvider 獲取一般信息。

處理幫助按鈕和 F1。

使用 HTML 幫助。

編譯的 HTML 幫助。

使用 HelpProvider 組件。

顯示幫助內容、索引和搜索。

我們在哪裡?



4. 繪圖基礎。

繪製到螢幕。

處理 Paint 事件。

觸發 Paint 事件。

顏色。

已知顏色。

顏色轉換。

畫筆。

實心畫筆。

紋理畫筆。

斜紋畫筆。

線性漸變畫筆。

路徑漸變畫筆。

鋼筆。

線帽。

虛線。

對齊。

連接。

從畫筆創建鋼筆。

形狀。

曲線。

平滑模式。

保存和恢復圖形設置。

路徑。

填充模式。

圖像。

加載和繪製圖像。

縮放、裁剪、平移和傾斜。

旋轉和翻轉。

重新上色。

透明度。

動畫。

繪製到圖像。

圖示。

游標。

我們在哪裡?



5. 繪製文字。

字型。

創建字型。

字型系列。

字型特徵。

字型高度。

字串。

格式化。

字串和路徑。

我們在哪裡?



6. 進階繪圖。

頁面單位。

將像素轉換為頁面單位。

變換。

縮放。

縮放字型。

旋轉。

平移。

剪切。

合併變換。

變換輔助工具。

路徑變換。

區域。

構建和填充區域。

裁剪到區域。

區域組合操作。

優化繪圖。

雙緩衝。

其他繪圖選項。

我們在哪裡?



7. 列印。

列印文件。

列印控制器。

列印預覽。

基本列印事件。

邊距。

頁面設置。

印表機設置。

列印範圍。