Using Styles in Stencils and Templates

3 4

When you're designing stencils and templates for others to use, your styles should be consistent and easy to apply. Users can perceive styles as the only formatting options available, so it's often better to include a larger number of styles in your templates than your user might need.

Figure 10-5.  The <b>Style</b> list on the <b>Formatting</b> toolbar makes styles that apply text formatting easily accessible.

Figure 10-5 The Style list on the Formatting toolbar makes styles that apply text formatting easily accessible.

Keeping Styles Consistent across Files

When you create a stencil that will be used with a template, the style definitions should be the same in both the stencil and template files. When a user creates an instance of a master, the instance inherits the master's styles, which are applied as follows:

  • If a style of the same name does not already exist in the drawing file, it is copied from the stencil file and added to the drawing file.
  • If a style of the same name already exists in the drawing file, the existing style is used.

If the style's definition in the drawing file differs from the definition in the stencil file, the drawing's definition is used, and the shape's appearance in the drawing is different from that of the master. This behavior is sometimes referred to as the "home team wins" rule, because the style on the drawing page "wins" over the formatting attributes of a style with the same name in a master.

If you plan to save the drawing page as a stencil or template, you'll save file space by deleting any styles that are not used by your shapes. To do this, use the Define Styles command on the Format menu and delete styles that you haven't used. Alternatively, you can open a new drawing file that contains only the default styles, and then drag the shapes formatted with the styles you want to copy into the new file. For details about cleaning up stencils and templates, see Chapter 13, Packaging Stencils and Templates.

If a shape on the drawing page or on the document stencil uses a style that you delete, the following occurs:

  • If the style was based on another style, the shape assumes the base style.
  • If the style wasn't based on another style, the shape assumes the No Style style, a default Microsoft Visio style that cannot be edited or deleted.

Using Naming Conventions for Styles

The styles you create for your stencils and templates will be easier to use if you consistently follow a naming convention. Explicit style names, such as "Quarter-Inch Black Line" or "8-pt Arial Left," are more expressive and understandable than abbreviated names, such as "Line2" or "T8L." Styles appear in alphabetic order in the toolbar list and in the Style and Define Styles dialog boxes.

Good naming conventions keep related styles together in the lists, making it easier for users to find the styles they need. Line, fill, and text styles with similar attributes should have similar names. For example, if you name a 1-pixel-wide line style "1 Pixel Line," you should name a 3-pixel-wide line style "3 Pixel Line" rather than "Line3." It's a good idea to name styles based on how you expect them to be used:

  • Name styles specific to a shape or stencil according to the shape (or shapes) they're applied to, such as "Flow Connector Text."
  • Name general-purpose styles according to their formatting attributes, such as "Black Line" or "Arial Centered."

Tip


To make a style appear at the top of the Style list, preface the style's name with a character that has a low ASCII value, such as a hyphen (-). For example, "- Standard Line" or "- Corporate Blue."

Guidelines for Defining Styles

Visio developers follow these guidelines when defining styles. The following guidelines may be helpful as you define styles for the solutions you create:

  • Text styles should use the TrueType fonts provided with the Microsoft Windows operating system.
  • Limit font choices to those you know everyone using the Windows operating system will have. If you know that your users will have other fonts installed (especially those designed for specialized markets, such as cartographic symbols), you can also safely use those fonts in the styles you define.

  • Fill and line styles should use colors supported by a standard 256-color VGA monitor.
  • Limit color choices to the most basic graphics system your users might have. Depending on the audience for your solution and the audience's typical hardware configuration, you might be able to offer a more expansive selection.

  • Base styles on Normal, rather than on each other.
  • When you have a hierarchy of styles based on each other, changing one style automatically changes all styles that are based on it. This behavior might confuse inexperienced users, so you might choose to define styles that are not based on other styles. For a more experienced audience, however, you could take advantage of this powerful feature in your solutions.

  • Design styles to apply only one formatting attribute class (fill, line, or text), or all three.
  • Multiple-attribute styles can be confusing to new users. You might find, however, that your users always use one fill, one line, and one text style for a specific shape you're designing. If so, you can develop a style containing all three formatting types.



Developing Microsoft Visio Solutions 2001
Developing Microsoft Visio Solutions (Pro-Documentation)
ISBN: 0735613532
EAN: 2147483647
Year: 2004
Pages: 180

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net