Partager via


Visual Basic Concepts

Property Page Design Guidelines

You may find the following guidelines helpful in designing property pages that are professional-looking and easy to use.

  • When the property pages for your control are shown, focus should be on the first field of the first tab. To do this, give the first control on each PropertyPage the lowest TabIndex number for the page.

  • If properties are arranged in multiple columns on a page, tab order should usually be top to bottom in the first column, then move to the top of the next column.

  • Provide access keys (keyboard shortcuts) for all the fields on a property page.

    Note   The letter ‘A’ is not available as an access key, because the Property Pages dialog box uses it for the Apply button.

  • Place standard property pages for fonts, colors, and pictures at the end of the list of property pages for a control.

  • Group similar properties together — for example, all properties that affect a control’s appearance should go on the same page.

  • Use a uniform size for your property pages. When the Property Pages dialog box displays multiple pages, it uses the same width and height for all of them.

    Tip   The standard pages for fonts, colors, and pictures are all the same size. If you use these pages, set your other property pages to this standard size. A quick way to set the standard size is to set the StandardSize property of the PropertyPage to Large at design time.

  • For ease of use, keep the number of tabs to a minimum. For example, don’t add a tab for your control’s About box.

  • Most control components (.ocx files) that provide more than one control have a page with the caption "General" which contains items that are common to many controls.

  • Keep your pages simple and fast. Your users will be generally be developers employing your control to get a job done — animation and fancy graphics will just get in their way.

  • The Property Pages dialog box will show a Help button if you’ve used the General tab of the Project Options dialog box to add a Help file to your project. You can set the HelpContextID properties of your property pages and of the controls they contain.

  • When you add labels to your property pages, make sure you include the property name in the label. You may want to localize your control for international use, or add user-friendly captions for the benefit of desktop tools such as Microsoft Office, but remember that the user must be able to identify the actual property names in order to write code for them, or look them up in your Help file.

  • When you create strings for the named constants in an enumeration, always include the actual constant name, because that’s what the person using your control will have to use when programming.

  • If you plan to localize your control component for international use, make sure that combo boxes, text boxes, and so on are wide enough to accommodate translated strings. If you plan to localize for locales — such as Japan — that use DBCS characters, make sure the font you’re using is available on DBCS systems, and that the height of your text boxes will accommodate DBCS characters.

  • Avoid showing dialog boxes from property pages. (The File Open dialog is an exception to this rule.)

  • Cross-tab property dependencies. If two properties interact — for example, if setting the value of one property limits the valid values for another property — place the properties on the same page.

For More Information*   Rules for layout that simplifies localization can be found in "International Issues," in the *Visual Basic Programmer’s Guide.