ColorTranslator.ToWin32(Color) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Convertit la structure Color spécifiée en couleur 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
Paramètres
Retours
Valeur de couleur Windows.
Exemples
L’exemple suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse
, qui est un paramètre du Paint gestionnaire d’événements. Le code traduit une Color structure en entier qui représente une couleur Windows, puis affiche une boîte de message avec la chaîne résultante.
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
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour