ColorTranslator.ToWin32(Color) Metodo

Definizione

Converte la struttura Color specificata in un colore di Windows.

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

Parametri

c
Color

Struttura Color da convertire.

Restituisce

Valore del colore di Windows.

Esempio

L'esempio seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, che è un parametro del Paint gestore eventi. Il codice converte una struttura in un Color intero che rappresenta un colore di Windows e quindi mostra una finestra di messaggio con la stringa risultante.

public:
   void ToWin32_Example( PaintEventArgs^ /*e*/ )
   {
      // Create an instance of a Color structure.
      Color myColor = Color::Red;

      // Translate myColor to an OLE color.
      int winColor = ColorTranslator::ToWin32( myColor );

      // Show a message box with the value of winColor.
      MessageBox::Show( winColor.ToString() );
   }
public void ToWin32_Example(PaintEventArgs e)
{
    // Create an instance of a Color structure.
    Color myColor = Color.Red;
             
    // Translate myColor to an OLE color.
    int winColor = ColorTranslator.ToWin32(myColor);
             
    // Show a message box with the value of winColor.
    MessageBox.Show(winColor.ToString());
}
Public Sub ToWin32_Example(ByVal e As PaintEventArgs)

    ' Create an instance of a Color structure.
    Dim myColor As Color = Color.Red

    ' Translate myColor to an OLE color.
    Dim winColor As Integer = ColorTranslator.ToWin32(myColor)

    ' Show a message box with the value of winColor.
    MessageBox.Show(winColor)
End Sub

Si applica a