Region 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
사각형과 경로로 구성된 그래픽 모양의 내부를 설명합니다. 이 클래스는 상속될 수 없습니다.
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(RectangleF) |
지정된 Region 구조체에서 새 RectangleF을 초기화합니다. |
Region(RegionData) |
지정된 데이터에서 새 Region을 초기화합니다. |
메서드
적용 대상
추가 정보
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기