You can use your favorite social network to register or link an existing account:
Or use your email address to register without a social network:
Sign in with these social networks:
Or enter your username and password
Forgot your password?
Yes, please link my existing account with for quick, secure access.
No, I would like to create a new account with my profile information.
Tips
How-to
News
Videos
Stories
Visio Home
Visio Answers forum
Visio MSDN forum
MSDN for Visio Developers
TechNet for Visio Services in SharePoint
Chris Hopkins' Visilog
Contact Us
In a previous blog post, we introduced the new themes, variants, and styles feature in the new Visio.
Not only does this feature make it easy and fast for users to create professional looking diagrams, it also fully supports programmatic access. This post will focus on how to use the new API methods to apply modern and vibrant looks to any diagram.
You can find more information on other new API in our blog post on new APIs in the new Visio. You can also see a full list of all new API in the What's new for Visio 2013 developers article on MSDN.
The new Visio supports the new themes, variants, and styles with three new methods: Page.SetTheme, Page.SetThemeVariant, and Shape.SetQuickStyle. With these methods, a developer can set the theme of a given page, apply a variant of the theme, and customize a shape with a style.
Page.SetTheme(varThemeIndex, varColorScheme, varEffectScheme, varConnectorScheme, varFontScheme)
Sets the specified components of a theme on the given page. The varThemeIndex argument is the primary argument that applies one of the built-in themes to the given page. The other four optional arguments allow for further customization by utilizing alternate definitions for color and style sourced from other built-in themes. Choosing different indexes for these four optional arguments gives you a unique combination of properties that is not found in the built-in list. All five arguments are specified as indexes representing the set of built-in themes. The indexes of all five arguments start at 17 for "Visio Theme 1", and end at 32 for "Visio Theme 16". Please note that these index values are only relevant to the preview build and are subject to change for the final release.
Arguments:
varFontScheme: Optional parameter specifying the index of the text styles used by the theme.
Page.SetThemeVariant(variantColor, variantStyle, embellishment)
Sets the specified variant component indexes and the embellishment setting on the given page. A variant is composed of two components: color and style. Using the same indexes for both will produce a variant that is accessible through the Variants gallery in the Ribbon's Design tab. Using a different index for each will produce a unique combination variant that is not found in the UI. The embellishment setting corresponds to the settings in the Variants gallery's flyout menu, and the setting can range from "low", to "medium", and finally to "high". The variant component indexes starts at 0 for "Variant 1" and ends at 3 for "Variant 4". The embellishment setting's index starts at 1 for "low" and ends at 3 for "high".
embellishment: Optional argument specifying the embellishment setting's index.
Shape.SetQuickStyle(lineMatrix, fillMatrix, effectsMatrix, fontMatrix, lineColor, fillColor, shadowColor, fontColor)
Sets the specified shape style on the given shape. Shape styles are controlled by eight indexes which stipulate colors and formatting for lines, fills, effects, and text. All shape styles found in the Shape Styles gallery in the Home tab on the ribbon can be set using this method. In addition, this method also allows each index to be controlled independently to produce unique shape style combinations not found in this gallery.
You can choose to set shape styles from either the "Variant Styles" section or the "Theme Styles" section of the Shape Styles gallery in the Home tab on the ribbon:
To set shape styles from the "Variant Styles" section:
Style and color indexes run from left to right, starting with 100 for the left-most selection and ending with 103 for the right-most selection. The following illustrates the indexes for the "Variant Styles" section, where style indexes are represented by blue colored text and color indexes are represented by red colored text:
To set shape styles from the "Theme Styles" section:
Style indexes correspond to the rows of the "Theme Styles" section of the Shape Styles gallery. Style indexes start from 1 for the top-most row and end at 6 for the bottom-most row. Color indexes correspond to the columns. Color indexes starts from 100 for the left-most column and ends at 106 for the right-most column. The following illustrates the indexes for the "Theme Styles" section, where style indexes are represented by blue colored text and color indexes are represented by red colored text:
Here is a diagram that we will be formatting:
Using the methods listed above, we will apply themes, variants, and shape styles to this diagram. In each step, we will show you the C# code along with a screenshot of how it changed the diagram.
Note: In the code snippets below, page refers to the active drawing page.
First, let's apply a theme to the diagram using the SetTheme method:
// Apply Visio Theme 16 to the diagram page
page.SetTheme(32)
This yields the following result:
Second, let's apply the third variant of this theme to the diagram using the SetThemeVariant method:
// Apply the third variant to the diagram page
page.SetThemeVariant(2, 2);
Finally, let's apply a shape style to the "Finished Product" shape to highlight it against the rest of the diagram. I have chosen the bottom-right shape style in the "Theme Styles" section of the Shape Styles gallery, which in this theme and variant combination is a bright orange, solid-filled shape style:
// Get the "Finished Product" shape
Visio.Shape finishedProductShape = page.Shapes.get_ItemU("Custom 3");
// Apply the right-most shape style on the bottom row
finishedProductShape.SetQuickStyle(
// Specify the indexes of line, fill, effect, and font formatting
6, 6, 6, 6,
// Specify the indexes of line, fill, shadow, and font colors. Integer values can also be used.
106, 106, 106, 106);
The new themes, variants, and styles feature allows both end-users and developers to quickly and easily format a diagram with professional and modern designs. We're interested to hear what developers think of this API functionality.
The Visio Answers forum and the Visio MSDN forum are also available to discuss Visio. And don't forget to use Send a Smile or Send a Frown to let us know what you think of our changes.
Comments: (4) Collapse
Simple and effective.
Новый Visio поддерживает новые темы, варианты и стили тремя новыми способами: Page.SetTheme, Page.SetThemeVariant и Shape.SetQuickStyle. Эти методы позволяют разработчику задать тему для текущей страницы, применить вариант темы и настроить фигуру с использованием
Over the last few months, we’ve been posting about the new Visio – discussing features in depth and introducing the editions that will be available. Before we get started on a new series of posts, we thought it would be helpful to summarize
Comments: (loading) Collapse