Home > Plug-in Development > How to create a new plug-in Options page

How to create a new plug-in Options page

February 25th, 2011

This topic is about adding a DXCore Options page. It has three parts to make it easier to read and follow:

  1. Adding and designing an options page (this post)
  2. Implementing the options page settings storing logic
  3. Using settings from an options page inside a plug-in

Here’s the first part of the topic, and the steps we need to accomplish, to add an options page to your plug-in, and make it work:

  1. Run the options page wizard
  2. Layout controls on the page
  3. Add runtime behavior code for controls, if necessary

Let’s take a look at these steps in detail.

The Options Page Wizard

In the Visual Studio’s Solution Explorer tool window, right-click your DXCore plug-in project and choose Add | New Item

DXCore Add New Item menu

The Add New Item dialog appears. Follow these steps to add an Options page:

  1. Choose the Language section of you plug-in (CSharp or Visual Basic)
  2. Select the DXCore category inside of the Language section
  3. Select the Options Page template
  4. Specify a meaningful name. It is convention to prefix options pages with “Opt“.
  5. Click the Add button:

DXCore OptionsPage - Add New Item dialog

The New Options Page dialog will appear:

DXCore New Options Page dialog

There are three options to set here:

  • User Level

The User Level option determines when the page will be seen: for new users, for advanced users, or expert users. This mode is changed on the IDE tools Options Dialog, for example, at the Expert level, all options pages are visible.

  • Category

The Category list is populated with all the existing option categories automatically. You can select one of them, or specify your own. Sub-categories are separated with the backslash character (e.g., “Editor\Painting“).

  • Page Name

Enter the page name (it is recommended to use only characters that are legal for file names). You can change all these options later, inside the options page source code, but you’ll save some time if you set them correctly from the beginning.

Click OK. The options page wizard will generate the new options page item and add it to the active project:

DXCore New OptionsPage project item in SolutionExplorer

The Options Page design surface is activated in the editor after the item is added:

DXCore Options page design surface

Layout controls on the page

Populate your options page with controls suitable for manipulating your options. If you plan on sharing this options page with other developers outside of your team, it is recommended using only the .NET controls that ship with Visual Studio, or controls that ship with the DXCore (the controls located in the “DXCore…” groups of the Toolbox).

Adding runtime behavior code for controls

Here, you might want to fill the control content with appropriate items, group radio buttons, implement drag-n-drop behavior for controls, etc.

The next step is to implement the logic of the options page to correctly read and write plug-in settings.

Products: DXCore
Versions: 10.2 and up
VS IDEs: any
Updated: Feb/26/2011
ID: D065

Similar Posts: