ColorTranslator.ToOle(Color) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Traduz a estrutura especificada Color para uma cor 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
Devoluções
O valor de cor OLE.
Exemplos
O exemplo seguinte foi concebido para uso com Windows Forms e requer PaintEventArgse, que é um parâmetro do handler de eventos Paint. O código traduz uma Color estrutura para um inteiro que representa uma cor OLE, e depois mostra uma caixa de mensagem com a cadeia 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