ApplicationSettings.DrawingBackgroundColorGradient プロパティ (Visio)

現在のセッションの Microsoft Visio 図面ウィンドウの背景に表示されるグラデーション カラーを指定します。 値の取得と設定が可能です。

構文

DrawingBackgroundColorGradient

ApplicationSettings オブジェクトを表す変数。

戻り値

OLE_COLOR

注釈

Visio 内で OLE_COLOR プロパティに使用できる値は、次のいずれかです。

  • &H00 bbggrr です。bb は 0 から 0xFF (255) の青の値、gg は緑の値、rr は赤の値です。

  • &H800000 xxxx は有効な 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 を設定しても、開いている他のウィンドウ用の設定にはまったく影響しません。

注:

図面の背景色は 2 色指定できます。 ユーザーの画面解像度が適切な場合、画面上部から下部へと、一方の色からもう一方の色へのグラデーションが実行されます。 この機能を使用する場合は、モニターの表示色を 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 のサポートおよびフィードバックを参照してください。