![]() Open the code view and close the design view for the form you are upgrading. I will assume you are using Visual Studio to edit your code. My suggestion is to charge forward with the simple changes listed here, then if the compiler complains, resolve any remaining issues. Second, the new class structures are complex, so my suggestions may only get you started. If you make a mistake or if my tips lead you astray, you could easily end up with code that the designer cannot interpret, locking you out of the ability to modify your form until the bugs have been found. It is always dangerous to manually change the code created by the designer. It won't cover every possibility, so you may have to correct some things after an initial compilation.įirst, I strongly encourage you to save a backup of your entire project before you start editing. My goal is to save you some time by providing a step-by-step guide to the major changes. If you use search and replace, it is not obvious how to proceed and mistakes are easily made. ![]() However, if you are upgrading code, it is a large task to recreate all of your old menus and toolbars in the designer. If you are writing a new application, there should be no problem creating new MenuStrips and ToolStrips using the Visual Studio designer. I have included the code and a sample application to demonstrate the behavior of these new classes. For those who prefer the Office 2003 user interface, I have also implemented a "Suppress Highlighting" feature to enable mouseover highlighting only when the parent form (or one of its children) is active. To me, this means they are ready for action, but unfortunately they still require a second click.īorrowing code from Rick Brewster, I have extended the ToolStrip and MenuStrip classes to implement a feature that allows a single click to activate the control. Unlike Office 2003, ToolStrip or MenuStrip will still show a highlight when the mouse moves over them on an inactive form. Also, the new controls have a "feature" (I'm trying to be kind) that is very confusing to me. However, it would be better if the user could choose this model or the more standard approach in which a single click activates the control. This is a perfectly fine model for the user interface and is the way Office 2003 and Visual Studio 2005 work. Instead, you must click on the control twice before it responds, once to activate the form and the second time to activate the control. First, unlike most Windows applications, the buttons and menus do not respond to a single click when their parent form does not have focus. Having gone through the trouble of making the conversion, you may discover that the new controls behave in a fashion you did not expect, which might not be to your taste. In the end I decided to take notes on what I had to do and share it with the Code Project community. I searched the Internet in vain for a simple process to follow. Since the structures of the new classes are quite different, it is not entirely straightforward to upgrade the old controls. For example, you can easily put ComboBoxes in menus or progress bars in a ToolStrip or StatusStrip. The new classes have a more up-to-date appearance and can be extended in new ways. Likewise, the ToolBar class has been replaced with ToolStrip. The MainMenu and ContextMenu classes have been replaced with entirely new classes, MenuStrip and ContextMenuStrip. ![]() NET Framework that you would like to upgrade to the fancier menus and toolbars that are available in the latest version. Like me, you probably have some legacy code written for the 1.x versions of the. It also introduces simple extensions to the ToolStrip and MenuStrip classes that allow customization of mouseover highlighting and implementation of "Click Through" to improve the user interface. This article gives some tips for making the conversion from the old to the new. Also, the user interface exhibits some unexpected behavior. Unfortunately the structure of each new class has changed dramatically and conversion is not trivial. NET Framework the support for menus and toolbars has been upgraded. ![]()
0 Comments
Leave a Reply. |