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에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET