ColorTranslator.FromOle(Int32) Metoda
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Tłumaczy wartość koloru OLE na strukturę GDI+ Color.
public:
static System::Drawing::Color FromOle(int oleColor);
public static System.Drawing.Color FromOle (int oleColor);
static member FromOle : int -> System.Drawing.Color
Public Shared Function FromOle (oleColor As Integer) As Color
Parametry
- oleColor
- Int32
Kolor OLE do tłumaczenia.
Zwraca
Struktura Color reprezentująca przetłumaczony kolor OLE.
Przykłady
Poniższy przykład jest przeznaczony do użycia z formularzami Systemu Windows i wymaga PaintEventArgse
, który jest parametrem programu obsługi zdarzeń Paint. Kod tłumaczy wartość koloru OLE na strukturę Color, a następnie używa tego koloru do wypełnienia prostokąta.
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.Graphics.FillRectangle( new SolidBrush(myColor), 0, 0,
100, 100);
}
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