共用方式為


Visio) (Window.BackgroundColorGradient 属性

會決定使用中 Microsoft Visio 繪圖視窗及其關聯的預覽列印和全螢幕檢視視窗的背景漸層色彩。 讀取/寫入。

語法

expressionBackgroundColorGradient

表達 代表 Window 物件的變數。

傳回值

OLE_COLOR

註解

Visio 中的 OLE_COLOR 屬性的有效值可以是下列其中一項:

  • &H00 bbggrr, 其中 bb 是介於 0 和 0xFF (255) 之間的藍色值、 匯總 綠色 值,以及 紅色值。

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

如需 GetSysColor 函式的詳細資訊,請在 MSDN 上的 Microsoft Platform SDK 中搜尋 “ GetSysColor ”。

OLE_COLOR數據類型用於傳回色彩的屬性。 當屬性宣告為 OLE_COLOR時,Visual Basic 編輯器編輯器中的 [ 屬性] 視窗會顯示色彩選擇器對話框,可讓使用者以可視化方式選取屬性的色彩,而不必記住對等數值。

此外,您也可以使用下列 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 以外的值) 覆寫該視窗集的 ApplicationSettings.DrawingBackgroundColorGradient 設定。 若要能夠針對同一組視窗重設此屬性,您必須將 BackgroundColorGradient 重設為其預設值 -1。 如果開啟多個繪圖,則為一組窗口設定 BackgroundColorGradient 不會影響其他開啟視窗集的設定。

不過,如果是ShapeSheet視窗,將視窗的 BackgroundColorGradient 屬性設定為預設值以外的值,對ShapeSheet視窗的背景色彩或任何其他視窗設定都沒有任何作用。

範例

下列 VBA 宏示範如何使用 BackgroundColorGradient 屬性來取得和設定活動視窗背景漸層色彩。 它也會示範如何從 Visio Application 物件取得 ApplicationSettings 物件,並示範 BackgroundColorGradient 屬性與 ApplicationSettings.DrawingBackgroundColorGradient 屬性之間的關聯性。 本範例假設 Visio 中開啟了使用中的繪圖視窗,而且一開始所有背景漸層色彩屬性都會設定為其預設值。

Public Sub BackgroundColorGradient_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 also changes the current 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 支援與意見反應