ColorTranslator::FromWin32 Method (Int32)
.NET Framework (current version)
Translates a Windows color value to a GDI+ Color structure.
Assembly: System.Drawing (in System.Drawing.dll)
Parameters
- win32Color
-
Type:
System::Int32
The Windows color to translate.
Return Value
Type: System.Drawing::ColorThe Color structure that represents the translated Windows color.
The following example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. The code translates a Windows color value to a Color structure, and then uses that color to fill a rectangle.
public: void FromWin32_Example( PaintEventArgs^ e ) { // Create an integer representation of a Windows color. int winColor = 0xA000; // Translate winColor to a GDI+ Color structure. Color myColor = ColorTranslator::FromWin32( winColor ); // Fill a rectangle with myColor. e->Graphics->FillRectangle( gcnew SolidBrush( myColor ), 0, 0, 100, 100 ); }
.NET Framework
Available since 1.1
Available since 1.1
Show: