ColorTranslator.ToWin32(Color) 메서드

정의

지정된 Color 구조체를 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

매개 변수

c
Color

변환할 Color 구조체입니다.

반환

Windows 색상 값을 반환합니다.

예제

다음 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 구조체를 Color Windows 색을 나타내는 정수로 변환한 다음 결과 문자열이 있는 메시지 상자를 표시합니다.

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

적용 대상