Icon 클래스

정의

개체를 나타내는 데 사용되는 작은 비트맵 이미지인 Windows 아이콘을 나타냅니다. 아이콘은 시스템에 의해 크기가 결정되지만, 투명한 비트맵으로 생각될 수 있습니다.

public ref class Icon sealed : MarshalByRefObject, ICloneable, IDisposable, System::Runtime::Serialization::ISerializable
public sealed class Icon : MarshalByRefObject, ICloneable, IDisposable, System.Runtime.Serialization.ISerializable
[System.ComponentModel.TypeConverter("System.Drawing.IconConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")]
public sealed class Icon : MarshalByRefObject, ICloneable, IDisposable, System.Runtime.Serialization.ISerializable
[System.ComponentModel.TypeConverter(typeof(System.Drawing.IconConverter))]
public sealed class Icon : MarshalByRefObject, ICloneable, IDisposable, System.Runtime.Serialization.ISerializable
[System.ComponentModel.TypeConverter(typeof(System.Drawing.IconConverter))]
[System.Serializable]
public sealed class Icon : MarshalByRefObject, ICloneable, IDisposable, System.Runtime.Serialization.ISerializable
[System.ComponentModel.TypeConverter(typeof(System.Drawing.IconConverter))]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(false)]
public sealed class Icon : MarshalByRefObject, ICloneable, IDisposable, System.Runtime.Serialization.ISerializable
type Icon = class
    inherit MarshalByRefObject
    interface ICloneable
    interface IDisposable
    interface ISerializable
[<System.ComponentModel.TypeConverter("System.Drawing.IconConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")>]
type Icon = class
    inherit MarshalByRefObject
    interface ICloneable
    interface IDisposable
    interface ISerializable
[<System.ComponentModel.TypeConverter(typeof(System.Drawing.IconConverter))>]
type Icon = class
    inherit MarshalByRefObject
    interface ICloneable
    interface IDisposable
    interface ISerializable
[<System.ComponentModel.TypeConverter(typeof(System.Drawing.IconConverter))>]
[<System.Serializable>]
type Icon = class
    inherit MarshalByRefObject
    interface ICloneable
    interface IDisposable
    interface ISerializable
[<System.ComponentModel.TypeConverter(typeof(System.Drawing.IconConverter))>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(false)>]
type Icon = class
    inherit MarshalByRefObject
    interface ISerializable
    interface ICloneable
    interface IDisposable
[<System.ComponentModel.TypeConverter(typeof(System.Drawing.IconConverter))>]
[<System.Serializable>]
type Icon = class
    inherit MarshalByRefObject
    interface ISerializable
    interface ICloneable
    interface IDisposable
Public NotInheritable Class Icon
Inherits MarshalByRefObject
Implements ICloneable, IDisposable, ISerializable
상속
특성
구현

예제

다음 코드 예제에서는 ToBitmap 메서드를 사용하는 방법을 보여 줍니다. 이 예제는 Windows Forms 함께 사용하도록 설계되었습니다. 양식을 만들고 다음 코드를 붙여넣습니다. IconToBitmap 로 전달 ePaintEventArgs하여 양식의 Paint 이벤트 처리기에서 메서드를 호출합니다.

private:
   void IconToBitmap( PaintEventArgs^ e )
   {
      // Construct an Icon.
      System::Drawing::Icon^ icon1 = gcnew System::Drawing::Icon( SystemIcons::Exclamation,40,40 );

      // Call ToBitmap to convert it.
      Bitmap^ bmp = icon1->ToBitmap();

      // Draw the bitmap.
      e->Graphics->DrawImage( bmp, Point(30,30) );
   }
private void IconToBitmap(PaintEventArgs e)
{
    // Construct an Icon.
    Icon icon1 = new Icon(SystemIcons.Exclamation, 40, 40);

    // Call ToBitmap to convert it.
    Bitmap bmp = icon1.ToBitmap();

    // Draw the bitmap.
    e.Graphics.DrawImage(bmp, new Point(30, 30));
}
Private Sub IconToBitmap(ByVal e As PaintEventArgs)

    ' Construct an Icon.
    Dim icon1 As New Icon(SystemIcons.Exclamation, 40, 40)

    ' Call ToBitmap to convert it.
    Dim bmp As Bitmap = icon1.ToBitmap()

    ' Draw the bitmap.
    e.Graphics.DrawImage(bmp, New Point(30, 30))
End Sub

설명

파일, 스트림 또는 포함된 리소스에서 개체를 생성 Icon 할 수 있습니다. 생성자 목록은 를 참조하세요 Icon. 메서드를 사용하여 ToBitmapIcon 비트맵으로 변환할 수도 있습니다.

참고

.NET 6 이상 버전에서는 이 형식을 포함하는 System.Drawing.Common 패키지가 Windows 운영 체제에서만 지원됩니다. 플랫폼 간 앱에서 이 형식을 사용하면 컴파일 시간 경고 및 런타임 예외가 발생합니다. 자세한 내용은 Windows에서만 지원되는 System.Drawing.Common을 참조하세요.

아이콘 리소스에는 여러 아이콘 이미지가 포함될 수 있습니다. 하나의 아이콘 파일에는 여러 크기와 색 깊이의 이미지가 포함될 수 있습니다. 애플리케이션에서 사용 되는 이미지는 운영 체제 및 설정에 따라 달라 집니다. 다음 목록에서는 아이콘의 일반적인 크기를 자세히 설명합니다.

  • 16픽셀 x 16픽셀

  • 32픽셀 x 32픽셀

  • 48픽셀 x 48픽셀

생성자

Icon(Icon, Int32, Int32)

Icon 클래스의 새 인스턴스를 초기화하여 요청한 크기와 일치하는 아이콘의 버전을 찾아봅니다.

Icon(Icon, Size)

Icon 클래스의 새 인스턴스를 초기화하여 요청한 크기와 일치하는 아이콘의 버전을 찾아봅니다.

Icon(Stream)

지정된 데이터 스트림에서 Icon 클래스의 새 인스턴스를 초기화합니다.

Icon(Stream, Int32, Int32)

너비와 높이가 지정된 특정 데이터 스트림에서 Icon 클래스의 새 인스턴스를 초기화합니다.

Icon(Stream, Size)

지정된 스트림에서 지정된 크기로 Icon 클래스의 새 인스턴스를 초기화합니다.

Icon(String)

지정된 파일 이름을 사용하여 Icon 클래스의 새 인스턴스를 초기화합니다.

Icon(String, Int32, Int32)

지정된 파일의 지정된 너비와 높이를 사용하여 Icon 클래스의 새 인스턴스를 초기화합니다.

Icon(String, Size)

지정된 파일에서 지정된 크기로 Icon 클래스의 새 인스턴스를 초기화합니다.

Icon(Type, String)

지정된 어셈블리의 리소스에서 Icon 클래스의 새 인스턴스를 초기화합니다.

속성

Handle

Icon의 창 핸들을 가져옵니다. 이것은 핸들의 복사본이 아니므로 해제하지 마세요.

Height

Icon의 높이를 가져옵니다.

Size

Icon의 크기를 가져옵니다.

Width

Icon의 너비를 가져옵니다.

메서드

Clone()

Icon을 복제하여 중복 이미지를 만듭니다.

CreateObjRef(Type)

원격 개체와 통신하는 데 사용되는 프록시 생성에 필요한 모든 관련 정보가 들어 있는 개체를 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
Dispose()

Icon에서 사용하는 리소스를 모두 해제합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
ExtractAssociatedIcon(String)

지정된 파일에 들어 있는 이미지의 아이콘 표현을 반환합니다.

ExtractIcon(String, Int32, Boolean)

지정된 filePath에서 지정된 아이콘을 추출합니다.

ExtractIcon(String, Int32, Int32)

지정된 filePath에서 지정된 아이콘을 추출합니다.

Finalize()

가비지 컬렉션이 회수하기 전에 개체가 리소스를 해제하고 다른 정리 작업을 수행할 수 있게 합니다.

FromHandle(IntPtr)

지정한 창 핸들에서 아이콘(HICON)까지 GDI+ Icon을 만듭니다.

GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 현재의 수명 서비스 개체를 검색합니다.

(다음에서 상속됨 MarshalByRefObject)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
InitializeLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다.

(다음에서 상속됨 MarshalByRefObject)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
MemberwiseClone(Boolean)

현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
Save(Stream)

Icon을 지정한 출력 Stream에 저장합니다.

ToBitmap()

Icon을 GDI+ Bitmap으로 변환합니다.

ToString()

Icon을 설명하는, 사람이 인식할 수 있는 문자열을 가져옵니다.

명시적 인터페이스 구현

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

대상 개체를 serialize하는 데 필요한 데이터로 SerializationInfo를 채웁니다.

적용 대상

추가 정보