.NET: Setting the Default Font in a Windows Mobile/Compact Framework Custom Control |
Search [cffebkce] |
||
Previous Next Xoc Software Training RVBA Conventions Maya Calendar Program Company Information Tools ASP.NET and Other Tips .NET: Debugging Designer Features of a Custom Control in Visual Studio Articles.NET: Setting the Default Font in a Windows Mobile/Compact Framework Custom Control .NET Fixing C# XML Comments so they Work in Windows XP SP2 .NET: Getting and Setting the Application Version Number .NET: Getting the Path of the Executing Assembly .NET: Retrieving Assembly Attributes .NET: Setting the RootFolder to Other Values in the FolderBrowserDialog in .NET .NET: Sizing Columns in a ListView Control in .NET .NET: Using Remoting in .NET ASP.NET: Constructing a Graphic on the Fly in ASP.NET ASP.NET: Controlling Caching in ASP.NET Web Forms ASP.NET: How to use the FrontPage Server Extensions with ASP.NET ASP.NET: Seeing What is in the ViewState in ASP.NET Web Forms ASP.NET: Using Forms Authentication in ASP.NET ASP.NET: View Trace Information on your ASP.NET Web Pages ASP: Create XML from an ADO query ASP: Detect Incomplete Loads ASP: Including an ASP.NET Web Page In a Classic ASP Web Page ASP: Process .HTM Files with Scripts and Server Side Includes ASP: QuickSort Algorithm ASP: Retrieve all server variables from IIS ASP: Send Email from Active Server Page HTML: How to Create a Non-Scrolling Region in HTML IE: Allowing Only Certain ActiveX Controls to Run in Internet Explorer IIS: Creating a web site for testing in IIS Server IIS: Creating Multiple Web Sites within IIS on Windows 2000 and Windows XP Professional IIS: IIS/Visual InterDev Problems and Fixes IIS: Redirect a domain such as xoc.net to www.xoc.net SQL Server: Execute SQL Server Updategram Web Design: Design for People with Disabilities Web Design: Keep a Web Page out of the Google Cache Windows: Get HTTP Header of a Web Page using Telnet Windows: Testing Domain Names without DNS Windows: Using Hosts File to Access Web Sites with XP SP2 Windows: Windows XP Command Line Tools Windows Mobile: Reprogramming the Push-to-Talk Button on the AT&T Tilt Miscellaneous Downloads Links Search Other Xoc managed sites: http://grr.xoc.net http://www.986faq.com http://www.mayainfo.org https://mayacalendar.xoc.net http://www.yachtslog.com |
This tip applies to creating a custom control using Visual Studio 2008, Compact Framework 3.5, and Windows Mobile 5 or 6. To set a default font in a Windows Mobile/Compact Framework custom control:
An explanation: The ApplyDeviceDefaults tag is necessary to keep the designer from resetting the font to the Control class default of 9 point. The DefaultValue tag sets the default in the designer. This makes it so that if you right click on the property and select Reset, it will return to this font. The especially tricky part, though, is that although your control will use the Compact Framework 3.5, and that is the version of the font class that is used in the emulator, in the designer you are using the full version of the .NET Framework 2.0. If you try to reference the 3.5 version of the Font class in the xmta file, it won't be recognised in the designer as the class the font is instantiated from, and Reset will return the font to the Control class's default, instead of your default. It seems so simple, but it is so underdocumented it took me hours of fooling with it before I understood what was going on. Supplemental information that may help can be found in the article Creating and Migrating Smart Device Custom Controls by Using Visual Studio 2005. |
||
Top |
[www.xoc.net] Copyright © 1997-2023 by Gregory Reddick . All Rights Reserved. 02/20/09 01:28 |