ColorTranslator.ToOle(Color) Método

Definición

Convierte la estructura Color especificada en un color OLE.

public:
 static int ToOle(System::Drawing::Color c);
public static int ToOle (System.Drawing.Color c);
static member ToOle : System.Drawing.Color -> int
Public Shared Function ToOle (c As Color) As Integer

Parámetros

c
Color

Estructura Color que se va a convertir.

Devoluciones

Valor del color OLE.

Ejemplos

El ejemplo siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse, que es un parámetro del Paint controlador de eventos. El código traduce una estructura a un Color entero que representa un color OLE y, a continuación, muestra un cuadro de mensaje con la cadena resultante.

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 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

Se aplica a