ColorTranslator.FromOle メソッド
アセンブリ: System.Drawing (system.drawing.dll 内)
構文Dim oleColor As Integer Dim returnValue As Color returnValue = ColorTranslator.FromOle(oleColor)
戻り値
変換した OLE カラーを表す Color 構造体。
使用例次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードでは、OLE カラー値を Color 構造体に変換し、その色で四角形を塗りつぶします。
Public Sub FromOle_Example(ByVal e As PaintEventArgs) ' Create an integer representation of an HTML color. Dim oleColor As Integer = &HFF00 ' Translate oleColor to a GDI+ Color structure. Dim myColor As Color = ColorTranslator.FromOle(oleColor) ' Fill a rectangle with myColor. e.Graphics.FillRectangle(New SolidBrush(myColor), 0, 0, 100, 100) End Sub
public void FromOle_Example(PaintEventArgs e) { // Create an integer representation of an OLE color. int oleColor = 0xFF00; // Translate oleColor to a GDI+ Color structure. Color myColor = ColorTranslator.FromOle(oleColor); // Fill a rectangle with myColor. e.Graphics.FillRectangle( new SolidBrush(myColor), 0, 0, 100, 100); }
public: void FromOle_Example( PaintEventArgs^ e ) { // Create an integer representation of an OLE color. int oleColor = 0xFF00; // Translate oleColor to a GDI+ Color structure. Color myColor = ColorTranslator::FromOle( oleColor ); // Fill a rectangle with myColor. e->Graphics->FillRectangle( gcnew SolidBrush( myColor ), 0, 0, 100, 100 ); }
public void FromOle_Example(PaintEventArgs e) { // Create an integer representation of an OLE color. int oleColor = 0xFF00; // Translate oleColor to a GDI+ Color structure. Color myColor = ColorTranslator.FromOle(oleColor); // Fill a rectangle with myColor. e.get_Graphics().FillRectangle(new SolidBrush(myColor), 0, 0, 100, 100); } //FromOle_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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照- ColorTranslator.FromOle メソッドのページへのリンク