ColorTranslator.FromOle(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Translates an OLE color value to a GDI+ Color structure.
public:
static System::Drawing::Color FromOle(int oleColor);
public static System.Drawing.Color FromOle (int oleColor);
static member FromOle : int -> System.Drawing.Color
Public Shared Function FromOle (oleColor As Integer) As Color
Parameters
- oleColor
- Int32
The OLE color to translate.
Returns
The Color structure that represents the translated OLE color.
Examples
The following example is designed for use with Windows Forms, and it requires PaintEventArgs e
, which is a parameter of the Paint event handler. The code translates an OLE color value to a Color structure, and then uses that color to fill a rectangle.
public:
void FromOle_Example( PaintEventArgs^ e )
{
// Create an integer representation of an OLE color.
int oleColor = 0xFF00;
// Translate oleColor to a GDI+ Color structure.
Color myColor = ColorTranslator::FromOle( oleColor );
// Fill a rectangle with myColor.
e->Graphics->FillRectangle( gcnew SolidBrush( myColor ), 0, 0, 100, 100 );
}
public void FromOle_Example(PaintEventArgs e)
{
// Create an integer representation of an OLE color.
int oleColor = 0xFF00;
// Translate oleColor to a GDI+ Color structure.
Color myColor = ColorTranslator.FromOle(oleColor);
// Fill a rectangle with myColor.
e.Graphics.FillRectangle( new SolidBrush(myColor), 0, 0,
100, 100);
}
Public Sub FromOle_Example(ByVal e As PaintEventArgs)
' Create an integer representation of an HTML color.
Dim oleColor As Integer = &HFF00
' Translate oleColor to a GDI+ Color structure.
Dim myColor As Color = ColorTranslator.FromOle(oleColor)
' Fill a rectangle with myColor.
e.Graphics.FillRectangle(New SolidBrush(myColor), 0, 0, 100, 100)
End Sub
Applies to
التعاون معنا على GitHub
يمكن العثور على مصدر هذا المحتوى على GitHub حيث يمكنك أيضاً إضافة مشاكل وطلبات سحب ومراجعتها. للحصول على معلومات إضافية، اطلع على دليل المساهم لدينا.