DrawingBackgroundColorGradient Property [Visio 2003 SDK Documentation]

Determines the background gradient color of the Microsoft Office Visio drawing window.

colorRet = object.DrawingBackgroundColorGradient

object.DrawingBackgroundColorGradient = colorVal

colorRet    OLE_COLOR. Current background gradient color of the drawing window.

object    Required. An expression that returns an ApplicationSettings object.

colorVal   Required OLE_COLOR. New background gradient color of the drawing window.

Version added

2003

Remarks

Valid values for an OLE_COLOR property within Visio can be one of the following:

  • &H00bbggrr, where bb is the blue value between 0 and 0xFF (255), gg the green value, and rr the red value.
  • &H800000xx, where xx is a valid GetSysColor index.

For details about the GetSysColor function, search for "GetSysColor" in the Microsoft Platform SDK on MSDN.

The OLE_COLOR data type is used for properties that return colors. When a property is declared as OLE_COLOR, the Properties window displays a color-picker dialog box that allows the user to select the color for the property visually, rather than having to remember the numeric equivalent.

In addition, you can use the following Microsoft Visual Basic for Applications (VBA) color constants for OLE_COLOR.

Constant Value Description

vbBlack

0x0

Black

vbRed

0xFF

Red

vbGreen

0xFF00

Green

vbYellow

0xFFFF

Yellow

vbBlue

0xFF0000

Blue

vbMagenta

0xFF00FF

Magenta

vbCyan

0xFFFF00

Cyan

vbWhite

0xFFFFFF

White

Setting the DrawingBackgroundColorGradient property is equivalent to setting the Background color 2 option under Drawing window in the Color Settings dialog box. (On the Tools menu, click Options, click Advanced, and then click Color Settings.)

Setting the BackgroundColorGradient property of the active window to a value other than the default (-1) overrides the DrawingBackgroundColorGradient setting for that window. To be to reset the background gradient color of the same active window by setting the DrawingBackgroundColorGradient property, you must reset BackgroundColorGradient to its default value, -1. If multiple windows are open, setting BackgroundColorGradient for one window has no effect on the setting for other open windows.

Note  You can specify two colors for the drawing background. If users' screen resolution is adequate, one of the colors will grade into the other from the top to the bottom of the screen. To be able to use this feature, users must set their monitors to display 32-bit color. The ability to set drawing background color programmatically for users running in high-contrast mode is restricted.

Example

The following VBA macro shows how to use the DrawingBackgroundColorGradient property to get and set the application background gradient color. It also shows how to get an ApplicationSettings object from the Visio Application object, and it demonstrates the relationship between the DrawingBackgroundColorGradient property and the Window.BackgroundColorGradient property. This example assumes there is a drawing window open in Visio and that initially all background gradient color properties are set to their default values.

Public Sub DrawingBackgroundColorGradient_Example()

    Dim vsoApplicationSettings As Visio.ApplicationSettings
    Set vsoApplicationSettings = Visio.Application.Settings
    
    'Get the current application background gradient color.
    Debug.Print vsoApplicationSettings.DrawingBackgroundColorGradient
    
    'Get the current window background color gradient.
    Debug.Print ActiveWindow.BackgroundColorGradient
    
    'Change the application background gradient color. 
    'This will also change the current window color as
    'well as the setting in the Color Settings dialog box.
    vsoApplicationSettings.DrawingBackgroundColor = vbRed
        
    'Change the current window background gradient color.
    ActiveWindow.BackgroundColorGradient = vbMagenta
        
    'Change the application background gradient color again.
    'This time, there will be no change in the current
    'window color, but the dialog box setting will change.
    vsoApplicationSettings.DrawingBackgroundColorGradient = vbYellow
       
    'Reset Window.BackgroundColorGradient to its default value.
    ActiveWindow.BackgroundColorGradient = -1
       
    'Change the application background gradient color again.
    'Now both the current window color
    'and the dialog box setting change.
    vsoApplicationSettings.DrawingBackgroundColorGradient = vbBlue
            
End Sub

Applies to | ApplicationSettings object

See Also | BackgroundColor property | BackgroundColorGradient property | DrawingBackgroundColorGradient property | DrawingPageColor property