Download presentation
Presentation is loading. Please wait.
Published byBonnie Baldwin Modified over 7 years ago
1
Mike Harsh PRSL001 Program Manager Microsoft Corporation
Tips and Tricks: Answers to Common Questions when Building Windows Forms Applications Mike Harsh PRSL001 Program Manager Microsoft Corporation ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
2
Agenda 5 real world customer questions and solutions Questions
1/5/ :20 AM Agenda 5 real world customer questions and solutions TabControl with tabs on bottom Docking confusion Read-only ComboBox Tracking the true visibility of a control in a container DataBinding DateTimePicker to null Questions ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
3
Non-Top Aligned Tabs Visual styles and TabControl Alignment
1/5/ :20 AM Non-Top Aligned Tabs Visual styles and TabControl Alignment ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
4
Non-Top Aligned Tabs The problem
1/5/ :20 AM Non-Top Aligned Tabs The problem ComCtl v6 doesn’t implement other alignments Visual styles disabled Visual styles enabled ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
5
Non-Top Aligned Tabs The Solution
1/5/ :20 AM Non-Top Aligned Tabs The Solution Draw the TabControl UI in code Set ControlStyles.UserDraw to true ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
6
Docking Confusion What order are controls docked in?
1/5/ :20 AM Docking Confusion What order are controls docked in? ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
7
Docking Confusion The problem
1/5/ :20 AM Docking Confusion The problem Controls are docked based on their order in the Controls collection This is known as Z-order Docking issues due to Z-order can be tough to debug by looking at the designer ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
8
Docking Confusion The Solution
1/5/ :20 AM Docking Confusion The Solution Use the new Document Outline window in Visual Studio Ctrl+alt+t in the standard profile ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
9
ReadOnly ComboBox 1/5/2018 12:20 AM
©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
10
ReadOnly ComboBox The problem
1/5/ :20 AM ReadOnly ComboBox The problem ComboBox doesn’t support the concept of readonly Workaround of disabling the control doesn’t allow selection of text ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
11
ReadOnly ComboBox The Solution
1/5/ :20 AM ReadOnly ComboBox The Solution Implement a ReadOnly property on a ComboBox subclass Create a text field and a disabled button to place over the ComboBox ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
12
Tracking The True Visibility Of A Control In A Container
1/5/ :20 AM Tracking The True Visibility Of A Control In A Container ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
13
True Control Visibility The problem
1/5/ :20 AM True Control Visibility The problem Visible property always returns the correct state. VisibleChanged is only raised when the Visible property of the control is modified It’s not raised when a control’s parent’s Visible property is set to false ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
14
True Control Visibility The Solution
1/5/ :20 AM True Control Visibility The Solution Create a component that listens for all visibility changes and notifies a control when it is no longer on the screen Uses a window hook on the thread and listen for the WM_SHOWWINDOW and WM_WINDOWPOSCHANGING messages Users register a handler for a control visibility change ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
15
DataBinding DateTimePicker Null support for DateTimePicker
1/5/ :20 AM DataBinding DateTimePicker Null support for DateTimePicker ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
16
DataBinding DateTimePicker The problem
1/5/ :20 AM DataBinding DateTimePicker The problem DateTimePicker has no UI for displaying NULL DateTimePicker’s Value property is a DateTime You cannot set NULL to a value type Early bound compile error Late bound exception DataBinding infrastructure catches the exception, but doesn’t set the value ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
17
DataBinding DateTimePicker The Solution
1/5/ :20 AM DataBinding DateTimePicker The Solution Create a control that extends DateTimePicker and adds a Nullable<DateTime> property Use the DateTimePicker’s check box as the null UI Bind to the new property instead ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
18
Summary 5 real world customer questions and solutions
1/5/ :20 AM Summary 5 real world customer questions and solutions TabControl with tabs on bottom Docking confusion Read-only ComboBox Tracking the true visibility of a control in a container DataBinding DateTimePicker to null ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
19
Community Resources At PDC After PDC
1/5/ :20 AM Community Resources At PDC Interesting in helping with Visual Studio and Developer Platform’s future planning? Sign up at the Tools and Language Track Lounge to attend a focus group. For more information, go see 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 1pm) Labs FUNHOL15 ClickOnce Deployment PRSHOL17 New UI Features in Windows Forms PRSHOL18 New Data Features in Windows Forms PRSHOL19 Windows Forms: Advanced Layout The Windows Forms table in the Presentation track lounge Ask The Experts After PDC MSDN dev center: MSDN Forums: ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
20
© 2005 Microsoft Corporation. All rights reserved.
1/5/ :20 AM © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
21
Richtextbox With A Visual Style Border
1/5/ :20 AM Richtextbox With A Visual Style Border ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
22
Flashing A Window In The Taskbar
1/5/ :20 AM Flashing A Window In The Taskbar ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.