Region 클래스

정의

사각형과 경로로 구성된 그래픽 모양의 내부를 설명합니다. 이 클래스는 상속될 수 없습니다.

public ref class Region sealed : MarshalByRefObject, IDisposable
public sealed class Region : MarshalByRefObject, IDisposable
[System.Runtime.InteropServices.ComVisible(false)]
public sealed class Region : MarshalByRefObject, IDisposable
type Region = class
    inherit MarshalByRefObject
    interface IDisposable
[<System.Runtime.InteropServices.ComVisible(false)>]
type Region = class
    inherit MarshalByRefObject
    interface IDisposable
Public NotInheritable Class Region
Inherits MarshalByRefObject
Implements IDisposable
상속
특성
구현

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드 예제를 사용 Data 하는 방법을 보여 줍니다.에서 를 다른 에 대 한 RegionData를 설정 Data 하는 개체 RegionData 입니다.

private:
   void DemonstrateRegionData2( PaintEventArgs^ e )
   {
      //Create a simple region.
      System::Drawing::Region^ region1 = gcnew System::Drawing::Region( Rectangle(10,10,100,100) );

      // Extract the region data.
      System::Drawing::Drawing2D::RegionData^ region1Data = region1->GetRegionData();
      array<Byte>^data1;
      data1 = region1Data->Data;

      // Create a second region.
      System::Drawing::Region^ region2 = gcnew System::Drawing::Region;

      // Get the region data for the second region.
      System::Drawing::Drawing2D::RegionData^ region2Data = region2->GetRegionData();

      // Set the Data property for the second region to the Data from the first region.
      region2Data->Data = data1;

      // Construct a third region using the modified RegionData of the second region.
      System::Drawing::Region^ region3 = gcnew System::Drawing::Region( region2Data );

      // Dispose of the first and second regions.
      delete region1;
      delete region2;

      // Call ExcludeClip passing in the third region.
      e->Graphics->ExcludeClip( region3 );

      // Fill in the client rectangle.
      e->Graphics->FillRectangle( Brushes::Red, this->ClientRectangle );
      delete region3;
   }
private void DemonstrateRegionData2(PaintEventArgs e)
{

    //Create a simple region.
    Region region1 = new Region(new Rectangle(10, 10, 100, 100));

    // Extract the region data.
    System.Drawing.Drawing2D.RegionData region1Data = region1.GetRegionData();
    byte[] data1;
    data1 = region1Data.Data;

    // Create a second region.
    Region region2 = new Region();

    // Get the region data for the second region.
    System.Drawing.Drawing2D.RegionData region2Data = region2.GetRegionData();

    // Set the Data property for the second region to the Data from the first region.
    region2Data.Data = data1;

    // Construct a third region using the modified RegionData of the second region.
    Region region3 = new Region(region2Data);

    // Dispose of the first and second regions.
    region1.Dispose();
    region2.Dispose();

    // Call ExcludeClip passing in the third region.
    e.Graphics.ExcludeClip(region3);

    // Fill in the client rectangle.
    e.Graphics.FillRectangle(Brushes.Red, this.ClientRectangle);

    region3.Dispose();
}
Private Sub DemonstrateRegionData2(ByVal e As PaintEventArgs)

    'Create a simple region.
    Dim region1 As New Region(New Rectangle(10, 10, 100, 100))

    ' Extract the region data.
    Dim region1Data As System.Drawing.Drawing2D.RegionData = region1.GetRegionData
    Dim data1() As Byte
    data1 = region1Data.Data

    ' Create a second region.
    Dim region2 As New Region

    ' Get the region data for the second region.
    Dim region2Data As System.Drawing.Drawing2D.RegionData = region2.GetRegionData()

    ' Set the Data property for the second region to the Data from the first region.
    region2Data.Data = data1

    ' Construct a third region using the modified RegionData of the second region.
    Dim region3 As New Region(region2Data)

    ' Dispose of the first and second regions.
    region1.Dispose()
    region2.Dispose()

    ' Call ExcludeClip passing in the third region.
    e.Graphics.ExcludeClip(region3)

    ' Fill in the client rectangle.
    e.Graphics.FillRectangle(Brushes.Red, Me.ClientRectangle)

    region3.Dispose()

End Sub

설명

영역의 좌표는 월드 좌표로 지정되므로 확장성이 있습니다. 그러나 그리기 표면에서 내부는 이를 나타내는 픽셀의 크기와 모양에 따라 달라집니다. 애플리케이션에는 그리기 작업의 출력에 맞추는 지역을 사용할 수 있습니다. 이러한 지역을 클리핑 영역이라고 합니다. 클리핑에 영역을 사용하는 방법에 대한 자세한 내용은 방법: 지역에서 클리핑 사용을 참조하세요.

애플리케이션의 점 또는 사각형 영역을 교차 하는지 여부를 확인 하는 등의 적중 테스트 작업 영역을 사용할 수도 있습니다. 적중 테스트를 위해 지역을 사용하는 방법에 대한 자세한 내용은 방법: 지역에서 적중 테스트 사용을 참조하세요.

애플리케이션은 메서드 및 Brush 개체를 사용하여 Graphics.FillRegion 영역을 채울 수 있습니다.

참고

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

생성자

Region()

Region를 초기화합니다.

Region(GraphicsPath)

지정된 GraphicsPath을 사용하여 새 Region를 초기화합니다.

Region(Rectangle)

지정된 Region 구조체에서 새 Rectangle을 초기화합니다.

Region(RectangleF)

지정된 Region 구조체에서 새 RectangleF을 초기화합니다.

Region(RegionData)

지정된 데이터에서 새 Region을 초기화합니다.

메서드

Clone()

Region의 정확한 복사본을 만듭니다.

Complement(GraphicsPath)

Region과 교차하지 않는 지정된 GraphicsPath의 일부를 포함하도록 이 Region을 업데이트합니다.

Complement(Rectangle)

Region과 교차하지 않는 지정된 Rectangle 구조체의 일부가 들어 있는 이 Region을 업데이트합니다.

Complement(RectangleF)

Region과 교차하지 않는 지정된 RectangleF 구조체의 일부가 들어 있는 이 Region을 업데이트합니다.

Complement(Region)

Region과 교차하지 않는 지정된 Region의 일부를 포함하도록 이 Region을 업데이트합니다.

CreateObjRef(Type)

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

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

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

Equals(Object)

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

(다음에서 상속됨 Object)
Equals(Region, Graphics)

지정된 Region이 지정된 그리기 화면에 있는 이 Region과 같은지 여부를 테스트합니다.

Exclude(GraphicsPath)

지정된 Region와 교차하지 않는 이 개체 내부의 일부만 들어 있는 이 GraphicsPath을 업데이트합니다.

Exclude(Rectangle)

지정된 Region 구조체와 교차하지 않는 이 개체 내부의 일부만 들어 있는 이 Rectangle을 업데이트합니다.

Exclude(RectangleF)

지정된 Region 구조체와 교차하지 않는 이 개체 내부의 일부만 들어 있는 이 RectangleF을 업데이트합니다.

Exclude(Region)

지정된 Region와 교차하지 않는 이 개체 내부의 일부만 들어 있는 이 Region을 업데이트합니다.

Finalize()

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

FromHrgn(IntPtr)

핸들에서 지정된 기존 GDI 지역으로 새 를 초기화 Region 합니다.

GetBounds(Graphics)

RectangleF 개체의 그리기 화면에서 이 Region의 경계가 되는 사각형을 나타내는 Graphics 구조체를 가져옵니다.

GetHashCode()

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

(다음에서 상속됨 Object)
GetHrgn(Graphics)

지정된 그래픽 컨텍스트에서 Region에 대한 창 핸들을 반환합니다.

GetLifetimeService()
사용되지 않음.

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

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

RegionData을 설명하는 정보를 나타내는 Region를 반환합니다.

GetRegionScans(Matrix)

지정된 매트릭스 변환을 적용한 후 이 RectangleF과 유사한 Region 구조체 배열을 반환합니다.

GetType()

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

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

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

(다음에서 상속됨 MarshalByRefObject)
Intersect(GraphicsPath)

Region을 지정된 GraphicsPath의 교차 부분으로 업데이트합니다.

Intersect(Rectangle)

Region을 지정된 Rectangle 구조의 교차 부분으로 업데이트합니다.

Intersect(RectangleF)

Region을 지정된 RectangleF 구조의 교차 부분으로 업데이트합니다.

Intersect(Region)

Region을 지정된 Region의 교차 부분으로 업데이트합니다.

IsEmpty(Graphics)

지정된 그리기 화면에서 이 Region의 내부가 비었는지 여부를 테스트합니다.

IsInfinite(Graphics)

지정된 그리기 화면에서 이 Region의 내부 제한이 없는지 여부를 테스트합니다.

IsVisible(Int32, Int32, Graphics)

지정된 Region 개체를 사용하여 그릴 때 지정된 점이 이 Graphics 개체에 들어 있는지 여부를 검사합니다.

IsVisible(Int32, Int32, Int32, Int32)

지정된 사각형의 일부라도 이 Region에 들어 있는지 여부를 테스트합니다.

IsVisible(Int32, Int32, Int32, Int32, Graphics)

지정된 Region를 사용하여 그릴 때 지정된 사각형의 일부라도 이 Graphics에 들어 있는지 여부를 테스트합니다.

IsVisible(Point)

지정된 Point 구조체가 이 Region에 들어 있는지 여부를 테스트합니다.

IsVisible(Point, Graphics)

지정된 Point를 사용하여 그릴 때 지정된 Region 구조체가 이 Graphics에 들어 있는지 여부를 테스트합니다.

IsVisible(PointF)

지정된 PointF 구조체가 이 Region에 들어 있는지 여부를 테스트합니다.

IsVisible(PointF, Graphics)

지정된 PointF를 사용하여 그릴 때 지정된 Region 구조체가 이 Graphics에 들어 있는지 여부를 테스트합니다.

IsVisible(Rectangle)

지정된 Rectangle 구조체의 일부라도 이 Region에 들어 있는지 여부를 테스트합니다.

IsVisible(Rectangle, Graphics)

지정된 Rectangle를 사용하여 그릴 때 지정된 Region 구조체의 일부라도 이 Graphics에 들어 있는지 여부를 테스트합니다.

IsVisible(RectangleF)

지정된 RectangleF 구조체의 일부라도 이 Region에 들어 있는지 여부를 테스트합니다.

IsVisible(RectangleF, Graphics)

지정된 RectangleF를 사용하여 그릴 때 지정된 Region 구조체의 일부라도 이 Graphics에 들어 있는지 여부를 테스트합니다.

IsVisible(Single, Single)

지정된 점이 이 Region에 들어 있는지 여부를 테스트합니다.

IsVisible(Single, Single, Graphics)

지정된 Region를 사용하여 그릴 때 지정된 점이 이 Graphics에 들어 있는지 여부를 테스트합니다.

IsVisible(Single, Single, Single, Single)

지정된 사각형의 일부라도 이 Region에 들어 있는지 여부를 테스트합니다.

IsVisible(Single, Single, Single, Single, Graphics)

지정된 Region를 사용하여 그릴 때 지정된 사각형의 일부라도 이 Graphics에 들어 있는지 여부를 테스트합니다.

MakeEmpty()

Region을 빈 내부로 초기화합니다.

MakeInfinite()

Region 개체를 제한이 없는 내부로 초기화합니다.

MemberwiseClone()

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

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

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

(다음에서 상속됨 MarshalByRefObject)
ReleaseHrgn(IntPtr)

Region의 핸들을 해제합니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
Transform(Matrix)

지정된 Region로 이 Matrix을 변환합니다.

Translate(Int32, Int32)

지정된 크기로 이 Region의 좌표를 오프셋합니다.

Translate(Single, Single)

지정된 크기로 이 Region의 좌표를 오프셋합니다.

Union(GraphicsPath)

지정된 Region와 통합되게 이 GraphicsPath을 업데이트합니다.

Union(Rectangle)

지정된 Region 구조체와 통합되게 이 Rectangle을 업데이트합니다.

Union(RectangleF)

지정된 Region 구조체와 통합되게 이 RectangleF을 업데이트합니다.

Union(Region)

지정된 Region와 통합되게 이 Region을 업데이트합니다.

Xor(GraphicsPath)

교차 부분을 제외하고 지정된 Region와 통합되게 이 GraphicsPath을 업데이트합니다.

Xor(Rectangle)

교차 부분을 제외하고 지정된 Region 구조체와 통합되게 이 Rectangle을 업데이트합니다.

Xor(RectangleF)

교차 부분을 제외하고 지정된 Region 구조체와 통합되게 이 RectangleF을 업데이트합니다.

Xor(Region)

교차 부분을 제외하고 지정된 Region와 통합되게 이 Region을 업데이트합니다.

적용 대상

추가 정보