Compartilhar via


Unified Commands Sample

This sample demonstrates the implementation of a set of commands that unify some of the code behind menus, toolbars, and other objects. This subset of code is important because it can trigger often-used actions in an application. The set of commands can track changes and update common element types, such as check box selection status, visibility, and enabled status.

For information about using the samples, see the following topics:

Security noteSecurity Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

To build and run the sample using the command prompt

  1. At the command prompt, navigate to the location where you saved the uncompressed sample files.

  2. Navigate to the CS\UnifiedCommands or VB\UnifiedCommands subdirectory under the UnifiedCommands directory, depending on your choice of programming language.

  3. Type msbuild to build the sample using the solution (.sln) file provided.

  4. Type cd UnifiedCommandsDemo\bin to navigate to the location of the executable file.

  5. Type UnifiedCommandsDemo.exe to run the sample.

To build and run the sample using Visual Studio

  1. In Windows Explorer, navigate to the location where you saved the uncompressed sample files.

  2. Navigate to the CS\UnifiedCommands or VB\UnifiedCommands subdirectory under the UnifiedCommands directory, depending on your choice of programming language.

  3. Double-click the solution (.sln) file to open it in Visual Studio.

  4. In Visual Studio, press F5 to build and run the sample.

To use the UnifiedCommands Sample

  • The Unified Commands sample implements a simple word processor built on the RichTextBox control. It has options for changing the font size and face, as well as file operations such as load, save, and print.

Demonstrates

  • Implementing the IExtenderProvider interface to provide properties to components and controls.

See Also

Reference

RichTextBox
IExtenderProvider
ToolStrip

Concepts

Extender Provider Overview