ColorTranslator.ToOle-Methode
Übersetzt die angegebene Color-Struktur in eine OLE-Farbe.
Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)
Syntax
'Declaration
Public Shared Function ToOle ( _
c As Color _
) As Integer
'Usage
Dim c As Color
Dim returnValue As Integer
returnValue = ColorTranslator.ToOle(c)
public static int ToOle (
Color c
)
public:
static int ToOle (
Color c
)
public static int ToOle (
Color c
)
public static function ToOle (
c : Color
) : int
Parameter
- c
Die zu übersetzende Color-Struktur.
Rückgabewert
Der OLE-Farbwert.
Beispiel
Das folgende Beispiel ist für die Verwendung mit Windows Forms vorgesehen und erfordert PaintEventArgse, wobei es sich um einen Parameter des Paint-Ereignishandlers handelt. Der Code übersetzt eine Color-Struktur in eine ganze Zahl, die eine OLE-Farbe darstellt, und zeigt anschließend ein Meldungsfeld mit der resultierenden Zeichenfolge an.
Public Sub ToOle_Example(ByVal e As PaintEventArgs)
' Create an instance of a Color structure.
Dim myColor As Color = Color.Green
' Translate myColor to an OLE color.
Dim oleColor As Integer = ColorTranslator.ToOle(myColor)
' Show a message box with the value of htmlColor.
MessageBox.Show(oleColor.ToString())
End Sub
public void ToOle_Example(PaintEventArgs e)
{
// Create an instance of a Color structure.
Color myColor = Color.Red;
// Translate myColor to an OLE color.
int oleColor = ColorTranslator.ToOle(myColor);
// Show a message box with the value of oleColor.
MessageBox.Show(oleColor.ToString());
}
public:
void ToOle_Example( PaintEventArgs^ /*e*/ )
{
// Create an instance of a Color structure.
Color myColor = Color::Red;
// Translate myColor to an OLE color.
int oleColor = ColorTranslator::ToOle( myColor );
// Show a message box with the value of oleColor.
MessageBox::Show( oleColor.ToString() );
}
public void ToOle_Example(PaintEventArgs e)
{
// Create an instance of a Color structure.
Color myColor = Color.get_Red();
// Translate myColor to an OLE color.
int oleColor = ColorTranslator.ToOle(myColor);
// Show a message box with the value of oleColor.
MessageBox.Show(System.Convert.ToString(oleColor));
} //ToOle_Example
Plattformen
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 unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
ColorTranslator-Klasse
ColorTranslator-Member
System.Drawing-Namespace