Windows Forms: Harnessing The Power And Flexibility Of Windows Forms 2.0 Erick Ellis PRS402 Program Manager.NET Client Microsoft Corporation
Agenda ToolStrips Custom renderers, colors, items DataGridView Custom painting, formatting, column types BackgroundWorker Cancellation, progress updates, responsive UI TableLayoutPanel Dynamic layout, content Questions
ToolStrips Replaces MainMenu, ContextMenu, ToolBar and StatusBar HWNDless architecture Same OM across all containers System and professional renderers ToolStripControlHost
Toolstrips Custom Color Tables Custom Renderers Custom ToolStripItem
Datagridview Replaces DataGrid Extensible and Flexible Bound, Unbound, Virtual, Mixed Eleventy billion PMEs Text, Image, Button, Link cells/columns Cell-based, not Column-based Cell styles (Font, Color, Formatting) Cell-level events Mouse, Formatting, Validate, Error, others... Custom Column Types High performance Display, scrolling, updates
DataGridView Custom Styles and Colors Custom Styles and Colors Custom Formatting Custom Formatting Custom Painting Custom Painting Custom Column Types Custom Column Types
Backgroundworker BackgroundWorker Simplify creating responsive applications Easier to perform long running tasks without “freezing” the UI Simplify Thread use in Windows Forms applications
BackgroundWorker Cancellation Cancellation Progress Reporting Progress Reporting
Automatically acquired ThreadPool Thread no UI updates allowed… UI Thread DoWork(){ If (!CancellationPending){ If (!CancellationPending){ FindInFiles() FindInFiles() }} StartFindInFiles() ProgressChanged(){ Update UI Update UI} RunWorkerCompleted() EndFindInFiles() RunWorkerAsync() ReportProgress() Diagram: BackgroundWorker
Tablelayoutpanel Layout Controls TableLayoutPanel Similar to HTML Table control Address localization scenarios Facilitate creation of resizable UI Support data-driven UI (e.g., labels from a DB)
TableLayoutPanel Anchor Anchor AutoSize/AutoSizeMode AutoSize/AutoSizeMode Column & Row Styles Column & Row Styles
Diagram: Login Dialog Equal %, preserve minimum size, lower right alignment Only occupy necessary space Right aligned, Grow/Shrink to accommodate label length AutoScaleRightToLeft Font Changes DPI Changes
Summary Windows Forms in Visual Studio 2005 make it easier to build professional looking, professional behaving applications. Install Visual Studio 2005 Today /Default.aspx /Default.aspx
Resources: Windows Forms Smart Client on MSDN /windowsforms /windowsforms Windows Forms Web site Beta 1 Samples idbey%20Beta%201 idbey%20Beta%201 Online Discussion Forums /default.aspx /default.aspx
Community Resources At PDC For more information, go see PRS402 Windows Forms: Harnessing the Power and Flexibility of Windows Forms 2.0 (Tue 1:00 and 4:15pm) PRS407 Windows Forms: Occasionally Connected Smart Clients (Wed 11:00 am) PRS321 Windows Forms: Integrating Windows Forms and Windows Presentation Foundation ("Avalon") (Thur 11:30am) FUN222 Windows Vista: What’s New in Software Installation for Windows Vista: Exploring the Windows Installer (MSI) and ClickOnce Options (Fri 1:00 pm) Labs FUNHOL15 ClickOnce Deployment PRSHOL17 New UI Features in Windows Forms PRSHOL18 New Data Features in Windows Forms PRSHOL19 Windows Forms: Advanced Layout Ask The Experts After PDC MSDN dev center: MSDN Forums:
Your Feedback Is Important!
© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.