會決定 Microsoft Visio 繪圖視窗目前工作階段的背景漸層色彩。 讀取/寫入。
語法
運算式。DrawingBackgroundColorGradient
運算式 代表 ApplicationSettings 物件的變數。
傳回值
OLE_COLOR
註解
Visio 中的 OLE_COLOR 屬性的有效值可以是下列其中一項:
&H00 bbggrr, 其中 bb 是介於 0 到 0xFF (255) 之間的藍色值, gg 表示綠色值, rr 表示紅色 值。
&H800000 xx ,其中 xx 是有效的 GetSysColor 索引。
有關 GetSysColor 函數的詳細資訊,請在 MSDN 上的 Microsoft Platform 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 應用程式物件取得 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 支援與意見反應。