ApplicationSettings.DrawingBackgroundColorGradient 属性 (Visio)

确定当前会话的 Microsoft Visio 绘图窗口的背景渐变颜色。 读/写。

语法

表达式DrawingBackgroundColorGradient

表达 一个代表 ApplicationSettings 对象的变量。

返回值

OLE_COLOR

备注

Visio 中 OLE_COLOR 属性的有效值可以是下列值之一:

  • &H00 bbggrr, 其中 bb 是介于 0 和 0xFF (255) 之间的蓝色值, gg 为绿色值, rr 为红色值。

  • &H800000 xx ,其中 xx 是有效的 GetSysColor 索引。

有关 GetSysColor 函数的详细信息,请在 MSDN 上的 Microsoft 平台 SDK 中搜索“ GetSysColor ”。

OLE_COLOR 数据类型用于返回颜色的属性。 当属性声明为 OLE_COLOR 时,属性窗口将显示一个颜色选取器对话框,该对话框允许用户直观地选择属性的颜色,而无需记住等效的数字。

另外,您还可以为 OLE_COLOR 使用下列 Microsoft Visual Basic for Applications (VBA) 颜色常量。

常量 说明
vbBlack 0x0 黑色
vbRed 0xFF 红色
vbGreen 0xFF00 绿色
vbYellow 0xFFFF 黄色
vbBlue 0xFF0000 蓝色
vbMagenta 0xFF00FF 洋红
vbCyan 0xFFFF00 蓝绿
vbWhite 0xFFFFFF 白色

将活动窗口的 BackgroundColorGradient 属性设置为默认值 (-1) 以外的值会覆盖该窗口的 DrawingBackgroundColorGradient 设置。 若要能够通过设置 DrawingBackgroundColorGradient 属性重置同一活动窗口的背景渐变颜色,必须将 BackgroundColorGradient 重置为其默认值 -1。 如果打开了多个窗口,则设置一个窗口的 BackgroundColorGradient 不会影响打开的其他窗口的设置。

注意

您可以为绘图背景指定两种颜色。 如果用户的屏幕分辨率足够高,则其中一种颜色会沿着从屏幕顶部到底部的方向逐渐过渡为另一种颜色。 为了能使用此功能,用户必须将其显示器设置为显示 32 位颜色。 以编程方式为在高对比度模式下运行的用户设置绘图背景色的功能受到限制。

示例

以下 VBA 宏显示如何使用 DrawingBackgroundColorGradient 属性来获取和设置应用程序背景渐变颜色。 它还演示如何从 Visio Application 对象获取 ApplicationSettings 对象,并演示 DrawingBackgroundColorGradient 属性与 Window.BackgroundColorGradient 属性之间的关系。 此示例假定 Visio 中打开了一个绘图窗口,并且所有背景渐变颜色属性最初都设置为其默认值。

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 active window background color gradient. 
 Debug.Print ActiveWindow.BackgroundColorGradient 
 
 'Change the application background gradient color. 
 'This also changes the active window color as 
 'well as the setting in the Color Settings dialog box. 
 vsoApplicationSettings.DrawingBackgroundColor = vbRed 
 
 'Change the active window background gradient color. 
 ActiveWindow.BackgroundColorGradient = vbMagenta 
 
 'Change the application background gradient color again. 
 'This time, there is no change in the current 
 'window color, but the dialog box setting changes. 
 vsoApplicationSettings.DrawingBackgroundColorGradient = vbYellow 
 
 'Reset Window.BackgroundColorGradient to its default value. 
 ActiveWindow.BackgroundColorGradient = -1 
 
 'Change the application background gradient color again. 
 'Now both the active window color 
 'and the dialog box setting change. 
 vsoApplicationSettings.DrawingBackgroundColorGradient = vbBlue 
 
End Sub

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。