Visio (ApplicationSettings.DrawingBackgroundColor 属性)
會決定 Microsoft Visio 繪圖視窗目前工作階段的背景色彩。 讀取/寫入。
語法
表達式。DrawingBackgroundColor
表達 代表 ApplicationSettings 物件的 變數。
傳回值
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時,屬性視窗 會顯示色彩選擇器對話框,讓使用者以可視化方式選取屬性的色彩,而不必記住對等數值。
此外,您也可以使用下列 OLE_COLOR 的 Microsoft Visual Basic for Applications (VBA) 色彩常數。
常數 | 值 | 描述 |
---|---|---|
vbBlack | 0x0 | 黑色 |
vbRed | 0xFF | 紅色 |
vbGreen | 0xFF00 | 綠色 |
vbYellow | 0xFFFF | 黃色 |
vbBlue | 0xFF0000 | 藍色 |
vbMagenta | 0xFF00FF | 洋紅色 |
vbCyan | 0xFFFF00 | 青色 |
vbWhite | 0xFFFFFF | 白色 |
將活動視窗的 BackgroundColor 屬性設定為預設 (-1 以外的值) 會覆寫該視窗的 DrawingBackgroundColor 設定。 若要藉由設定 DrawingBackgroundColor 屬性來重設相同活動視窗的背景色彩,您必須將 BackgroundColor 重設為其預設值 -1。 如果開啟多個視窗,則設定一個視窗的 BackgroundColor 不會影響其他開啟視窗的設定。
注意事項
如果是在高對比模式下執行的使用者,則以程式設計方式設定繪圖背景色彩的能力會受到限制。
範例
下列 VBA 宏示範如何使用 DrawingBackgroundColor 屬性來取得和設定應用程式背景色彩。 它也會示範如何從 Visio Application 物件取得 ApplicationSettings 物件,並示範 DrawingBackgroundColor 屬性與 Window.BackgroundColor 屬性之間的關聯性。 本範例假設 Visio 中有一個開啟的繪圖視窗,而且一開始所有背景色彩屬性都會設定為其預設值。
Public Sub DrawingBackgroundColor_Example()
Dim vsoApplicationSettings As Visio.ApplicationSettings
Set vsoApplicationSettings = Visio.Application.Settings
'Get the current application background color.
Debug.Print vsoApplicationSettings.DrawingBackgroundColor
'Get the active window background color.
Debug.Print ActiveWindow.BackgroundColor
'Change the application background color.
'This will also change the active window color as
'well as the setting in the Color Settings dialog box
vsoApplicationSettings.DrawingBackgroundColor = vbRed
'Change the active window background color.
ActiveWindow.BackgroundColor = vbMagenta
'Change the application background color again.
'This time, there is no change in the current
'window color, but the dialog box setting changes.
vsoApplicationSettings.DrawingBackgroundColor = vbYellow
'Reset Window.BackgroundColor to its default value.
ActiveWindow.BackgroundColor = -1
'Change the application background color again.
'Now both the active window color
'and the dialog box setting change.
vsoApplicationSettings.DrawingBackgroundColor = vbBlue
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應