Region.GetRegionData 메서드

정의

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

public:
 System::Drawing::Drawing2D::RegionData ^ GetRegionData();
public System.Drawing.Drawing2D.RegionData GetRegionData ();
public System.Drawing.Drawing2D.RegionData? GetRegionData ();
member this.GetRegionData : unit -> System.Drawing.Drawing2D.RegionData
Public Function GetRegionData () As RegionData

반환

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

예제

다음 코드 예제는 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

설명

Region 클래스를 사용하면 사용자 지정 셰이프를 정의할 수 있습니다. 도형은 선, 다각형 및 곡선으로 구성될 수 있습니다. GetRegionData 는 이 Region에 포함된 셰이프를 설명합니다.

적용 대상