ColorTranslator.ToOle(Color) 메서드

정의

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

매개 변수

c
Color

변환할 Color 구조체입니다.

반환

OLE 색상 값을 반환합니다.

예제

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

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

적용 대상