ColorTranslator.FromWin32 メソッド
アセンブリ: System.Drawing (system.drawing.dll 内)

Dim win32Color As Integer Dim returnValue As Color returnValue = ColorTranslator.FromWin32(win32Color)
戻り値
変換した Windows カラーを表す Color 構造体。

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードでは、Windows カラー値を Color 構造体に変換し、その色で四角形を塗りつぶします。
Public Sub FromWin32_Example(ByVal e As PaintEventArgs) ' Create an integer representation of a Win32 color. Dim winColor As Integer = &HA000 ' Translate winColor to a GDI+ Color structure. Dim myColor As Color = ColorTranslator.FromWin32(winColor) ' Fill a rectangle with myColor. e.Graphics.FillRectangle(New SolidBrush(myColor), 0, 0, 100, 100) End Sub
public void FromWin32_Example(PaintEventArgs e) { // Create an integer representation of a Windows color. int winColor = 0xA000; // Translate winColor to a GDI+ Color structure. Color myColor = ColorTranslator.FromWin32(winColor); // Fill a rectangle with myColor. e.Graphics.FillRectangle( new SolidBrush(myColor), 0, 0, 100, 100); }
public: void FromWin32_Example( PaintEventArgs^ e ) { // Create an integer representation of a Windows color. int winColor = 0xA000; // Translate winColor to a GDI+ Color structure. Color myColor = ColorTranslator::FromWin32( winColor ); // Fill a rectangle with myColor. e->Graphics->FillRectangle( gcnew SolidBrush( myColor ), 0, 0, 100, 100 ); }
public void FromWin32_Example(PaintEventArgs e) { // Create an integer representation of a Windows color. int winColor = 0xA000; // Translate winColor to a GDI+ Color structure. Color myColor = ColorTranslator.FromWin32(winColor); // Fill a rectangle with myColor. e.get_Graphics().FillRectangle(new SolidBrush(myColor), 0, 0, 100, 100); } //FromWin32_Example

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からColorTranslator.FromWin32 メソッドを検索する場合は、下記のリンクをクリックしてください。

- ColorTranslator.FromWin32 メソッドのページへのリンク