Graphics.BeginContainer 메서드

정의

그래픽 컨테이너를 현재 상태로 Graphics 저장하고 새 그래픽 컨테이너를 열고 사용합니다.

오버로드

Name Description
BeginContainer()

그래픽 컨테이너를 현재 상태로 Graphics 저장하고 새 그래픽 컨테이너를 열고 사용합니다.

BeginContainer(Rectangle, Rectangle, GraphicsUnit)

그래픽 컨테이너를 현재 상태로 Graphics 저장하고 지정된 배율 변환과 함께 새 그래픽 컨테이너를 엽니다.

BeginContainer(RectangleF, RectangleF, GraphicsUnit)

그래픽 컨테이너를 현재 상태로 Graphics 저장하고 지정된 배율 변환과 함께 새 그래픽 컨테이너를 엽니다.

BeginContainer()

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

그래픽 컨테이너를 현재 상태로 Graphics 저장하고 새 그래픽 컨테이너를 열고 사용합니다.

public:
 System::Drawing::Drawing2D::GraphicsContainer ^ BeginContainer();
public System.Drawing.Drawing2D.GraphicsContainer BeginContainer();
member this.BeginContainer : unit -> System.Drawing.Drawing2D.GraphicsContainer
Public Function BeginContainer () As GraphicsContainer

반품

이 메서드는 GraphicsContainer 메서드 호출 시 이 Graphics 상태를 나타내는 값을 반환합니다.

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 PaintEventArgs 이벤트 처리기의 매개 변수인 ePaint 필요합니다. 코드는 다음 작업을 수행합니다.

  • 새 그래픽 컨테이너를 열고 이전 컨테이너를 저장합니다.

  • 컨테이너의 세계 좌표를 변환합니다.

  • 새 컨테이너의 변환된 좌표에 빨간색 사각형을 채웁니다.

  • 새 컨테이너를 닫고 저장된 컨테이너를 복원합니다.

  • 저장된 컨테이너의 녹색 사각형(번역되지 않은 좌표)을 채웁니다.

그 결과 동일한 크기의 빨간색 사각형에 덮어지는 녹색 사각형이 생성됩니다.

private:
   void BeginContainerVoid( PaintEventArgs^ e )
   {
      // Begin graphics container.
      GraphicsContainer^ containerState = e->Graphics->BeginContainer();

      // Translate world transformation.
      e->Graphics->TranslateTransform( 100.0F, 100.0F );

      // Fill translated rectangle in container with red.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 200, 200 );

      // End graphics container.
      e->Graphics->EndContainer( containerState );

      // Fill untransformed rectangle with green.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), 0, 0, 200, 200 );
   }
private void BeginContainerVoid(PaintEventArgs e)
{
    // Begin graphics container.
    GraphicsContainer containerState = e.Graphics.BeginContainer();
             
    // Translate world transformation.
    e.Graphics.TranslateTransform(100.0F, 100.0F);
             
    // Fill translated rectangle in container with red.
    e.Graphics.FillRectangle(new SolidBrush(Color.Red), 0, 0, 200, 200);
             
    // End graphics container.
    e.Graphics.EndContainer(containerState);
             
    // Fill untransformed rectangle with green.
    e.Graphics.FillRectangle(new SolidBrush(Color.Green), 0, 0, 200, 200);
}
Private Sub BeginContainerVoid(ByVal e As PaintEventArgs)

    ' Begin graphics container.
    Dim containerState As GraphicsContainer = _
    e.Graphics.BeginContainer()

    ' Translate world transformation.
    e.Graphics.TranslateTransform(100.0F, 100.0F)

    ' Fill translated rectangle in container with red.
    e.Graphics.FillRectangle(New SolidBrush(Color.Red), 0, 0, 200, 200)

    ' End graphics container.
    e.Graphics.EndContainer(containerState)

    ' Fill untransformed rectangle with green.
    e.Graphics.FillRectangle(New SolidBrush(Color.Green), 0, 0, _
    200, 200)
End Sub

설명

메서드와 함께 이 메서드를 EndContainer 사용하여 중첩된 그래픽 컨테이너를 만듭니다. 그래픽 컨테이너는 변환, 클리핑 영역 및 렌더링 속성과 같은 그래픽 상태를 유지합니다.

메서드BeginContainerGraphics 호출할 때 상태를 Graphics 보유하는 정보 블록이 스택에 배치됩니다. 메서드는 BeginContainer 해당 정보 블록을 식별하는 값을 반환 GraphicsContainer 합니다. 식별 개체를 메서드에 EndContainer 전달하면 정보 블록이 스택에서 제거되고 메서드 호출 당시 Graphics 의 상태로 복원 BeginContainer 하는 데 사용됩니다.

컨테이너를 중첩할 수 있습니다. 즉, 메서드를 호출하기 전에 메서드를 BeginContainer 여러 번 호출할 EndContainer 수 있습니다. 메서드를 BeginContainer 호출할 때마다 정보 블록이 스택에 배치되고 정보 블록에 대한 정보를 받 GraphicsContainer 습니다. 이러한 개체 중 하나를 메서드에 EndContainer 전달하면 해당 특정 개체를 반환한 메서드 호출 당시의 Graphics 상태로 반환됩니다BeginContainer.GraphicsContainer 해당 BeginContainer 메서드 호출에 의해 스택에 배치된 정보 블록은 스택에서 제거되고 해당 메서드 호출 후 BeginContainer 해당 스택에 배치된 모든 정보 블록도 제거됩니다.

메서드에 대한 호출은 Save 메서드 호출과 BeginContainer 동일한 스택에 정보 블록을 배치합니다. EndContainer 메서드 호출이 메서드 호출 BeginContainer 과 쌍을 Restore 이루는 것처럼 메서드 호출은 메서드 호출과 쌍을 이 Save 릅니다.

메서드를 EndContainer 호출할 때 메서드에 대한 해당 호출 Save 후 스택에 배치된 모든 정보 블록(BeginContainer메서드 또는 BeginContainer 메서드)이 스택에서 제거됩니다. 마찬가지로 메서드를 Restore 호출할 때 메서드에 대한 해당 호출 Save 후 스택에 배치된 모든 정보 블록(BeginContainer메서드 또는 Save 메서드)이 스택에서 제거됩니다.

메서드에 의해 BeginContainer 설정된 그래픽 상태에는 기본 그래픽 상태의 렌더링 품질이 포함됩니다. 메서드가 호출될 때 기존 렌더링 품질 상태가 기본값으로 다시 설정됩니다.

적용 대상

BeginContainer(Rectangle, Rectangle, GraphicsUnit)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

그래픽 컨테이너를 현재 상태로 Graphics 저장하고 지정된 배율 변환과 함께 새 그래픽 컨테이너를 엽니다.

public:
 System::Drawing::Drawing2D::GraphicsContainer ^ BeginContainer(System::Drawing::Rectangle dstrect, System::Drawing::Rectangle srcrect, System::Drawing::GraphicsUnit unit);
public System.Drawing.Drawing2D.GraphicsContainer BeginContainer(System.Drawing.Rectangle dstrect, System.Drawing.Rectangle srcrect, System.Drawing.GraphicsUnit unit);
member this.BeginContainer : System.Drawing.Rectangle * System.Drawing.Rectangle * System.Drawing.GraphicsUnit -> System.Drawing.Drawing2D.GraphicsContainer
Public Function BeginContainer (dstrect As Rectangle, srcrect As Rectangle, unit As GraphicsUnit) As GraphicsContainer

매개 변수

dstrect
Rectangle

Rectangle 매개 변수와 함께 컨테이너에 srcrect 대한 크기 조정 변환을 지정하는 구조체입니다.

srcrect
Rectangle

Rectangle 매개 변수와 함께 컨테이너에 dstrect 대한 크기 조정 변환을 지정하는 구조체입니다.

unit
GraphicsUnit

컨테이너의 GraphicsUnit 측정 단위를 지정하는 열거형의 멤버입니다.

반품

이 메서드는 GraphicsContainer 메서드 호출 시 이 Graphics 상태를 나타내는 값을 반환합니다.

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 PaintEventArgs 이벤트 처리기의 매개 변수인 ePaint 필요합니다. 코드는 다음 작업을 수행합니다.

  • 새 컨테이너에 대한 배율 변환을 지정하는 두 개의 사각형을 만듭니다.

  • 새 그래픽 컨테이너를 열고 이전 컨테이너를 저장합니다.

  • 새 컨테이너의 크기 조정된 좌표에 빨간색 사각형을 채웁니다.

  • 새 컨테이너를 닫고 저장된 컨테이너를 복원합니다.

  • 저장된 컨테이너의 녹색 사각형(크기가 조정되지 않은 좌표)을 채웁니다.

그 결과 작은 빨간색 사각형의 기초가 되는 녹색 사각형이 생성됩니다.

private:
   void BeginContainerRectangle( PaintEventArgs^ e )
   {
      // Define transformation for container.
      Rectangle srcRect = Rectangle(0,0,200,200);
      Rectangle destRect = Rectangle(100,100,150,150);

      // Begin graphics container.
      GraphicsContainer^ containerState = e->Graphics->BeginContainer( destRect, srcRect, GraphicsUnit::Pixel );

      // Fill red rectangle in container.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 200, 200 );

      // End graphics container.
      e->Graphics->EndContainer( containerState );

      // Fill untransformed rectangle with green.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), 0, 0, 200, 200 );
   }
private void BeginContainerRectangle(PaintEventArgs e)
{
    // Define transformation for container.
    Rectangle srcRect = new Rectangle(0, 0, 200, 200);
    Rectangle destRect = new Rectangle(100, 100, 150, 150);
             
    // Begin graphics container.
    GraphicsContainer containerState = e.Graphics.BeginContainer(
        destRect, srcRect,
        GraphicsUnit.Pixel);
             
    // Fill red rectangle in container.
    e.Graphics.FillRectangle(new SolidBrush(Color.Red), 0, 0, 200, 200);
             
    // End graphics container.
    e.Graphics.EndContainer(containerState);
             
    // Fill untransformed rectangle with green.
    e.Graphics.FillRectangle(new SolidBrush(Color.Green), 0, 0, 200, 200);
}
Private Sub BeginContainerRectangle(ByVal e As PaintEventArgs)

    ' Define transformation for container.
    Dim srcRect As New Rectangle(0, 0, 200, 200)
    Dim destRect As New Rectangle(100, 100, 150, 150)

    ' Begin graphics container.
    Dim containerState As GraphicsContainer = _
    e.Graphics.BeginContainer(destRect, srcRect, GraphicsUnit.Pixel)

    ' Fill red rectangle in container.
    e.Graphics.FillRectangle(New SolidBrush(Color.Red), 0, 0, 200, 200)

    ' End graphics container.
    e.Graphics.EndContainer(containerState)

    ' Fill untransformed rectangle with green.
    e.Graphics.FillRectangle(New SolidBrush(Color.Green), 0, 0, _
    200, 200)
End Sub

설명

메서드와 함께 이 메서드를 EndContainer 사용하여 중첩된 그래픽 컨테이너를 만듭니다. 그래픽 컨테이너는 변환, 클리핑 영역 및 렌더링 속성과 같은 그래픽 상태를 유지합니다.

메서드BeginContainerGraphics 호출할 때 상태를 Graphics 보유하는 정보 블록이 스택에 배치됩니다. 메서드는 BeginContainer 해당 정보 블록을 식별하는 값을 반환 GraphicsContainer 합니다. 식별 개체를 메서드에 EndContainer 전달하면 정보 블록이 스택에서 제거되고 메서드 호출 당시 Graphics 의 상태로 복원 BeginContainer 하는 데 사용됩니다.

컨테이너를 중첩할 수 있습니다. 즉, 메서드를 호출하기 전에 메서드를 BeginContainer 여러 번 호출할 EndContainer 수 있습니다. 메서드를 BeginContainer 호출할 때마다 정보 블록이 스택에 배치되고 정보 블록에 대한 정보를 받 GraphicsContainer 습니다. 이러한 개체 중 하나를 메서드에 EndContainer 전달하면 해당 특정 개체를 반환한 메서드 호출 당시의 Graphics 상태로 반환됩니다BeginContainer.GraphicsContainer 해당 BeginContainer 메서드 호출에 의해 스택에 배치된 정보 블록은 스택에서 제거되고 해당 메서드 호출 후 BeginContainer 해당 스택에 배치된 모든 정보 블록도 제거됩니다.

메서드에 대한 호출은 Save 메서드 호출과 BeginContainer 동일한 스택에 정보 블록을 배치합니다. EndContainer 메서드 호출이 메서드 호출 BeginContainer 과 쌍을 Restore 이루는 것처럼 메서드 호출은 메서드 호출과 쌍을 이 Save 릅니다.

메서드를 EndContainer 호출할 때 메서드에 대한 해당 호출 Save 후 스택에 배치된 모든 정보 블록(BeginContainer메서드 또는 BeginContainer 메서드)이 스택에서 제거됩니다. 마찬가지로 메서드를 Restore 호출할 때 메서드에 대한 해당 호출 Save 후 스택에 배치된 모든 정보 블록(BeginContainer메서드 또는 Save 메서드)이 스택에서 제거됩니다.

이 메서드는 및 dstrect 매개 변수를 사용하여 새 그래픽 컨테이너에 대한 크기 조정 변환을 srcrect 지정합니다. 눈금은 적용 srcrect할 때 결과가 되는 변환과 dstrect같습니다.

메서드에 의해 BeginContainer 설정된 그래픽 상태에는 기본 그래픽 상태의 렌더링 품질이 포함됩니다. 메서드가 호출될 때 기존 렌더링 품질 상태가 기본값으로 다시 설정됩니다.

적용 대상

BeginContainer(RectangleF, RectangleF, GraphicsUnit)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

그래픽 컨테이너를 현재 상태로 Graphics 저장하고 지정된 배율 변환과 함께 새 그래픽 컨테이너를 엽니다.

public:
 System::Drawing::Drawing2D::GraphicsContainer ^ BeginContainer(System::Drawing::RectangleF dstrect, System::Drawing::RectangleF srcrect, System::Drawing::GraphicsUnit unit);
public System.Drawing.Drawing2D.GraphicsContainer BeginContainer(System.Drawing.RectangleF dstrect, System.Drawing.RectangleF srcrect, System.Drawing.GraphicsUnit unit);
member this.BeginContainer : System.Drawing.RectangleF * System.Drawing.RectangleF * System.Drawing.GraphicsUnit -> System.Drawing.Drawing2D.GraphicsContainer
Public Function BeginContainer (dstrect As RectangleF, srcrect As RectangleF, unit As GraphicsUnit) As GraphicsContainer

매개 변수

dstrect
RectangleF

RectangleF 매개 변수와 함께 새 그래픽 컨테이너에 srcrect 대한 크기 조정 변환을 지정하는 구조체입니다.

srcrect
RectangleF

RectangleF 매개 변수와 함께 새 그래픽 컨테이너에 dstrect 대한 크기 조정 변환을 지정하는 구조체입니다.

unit
GraphicsUnit

컨테이너의 GraphicsUnit 측정 단위를 지정하는 열거형의 멤버입니다.

반품

이 메서드는 GraphicsContainer 메서드 호출 시 이 Graphics 상태를 나타내는 값을 반환합니다.

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 PaintEventArgs 이벤트 처리기의 매개 변수인 ePaint 필요합니다. 코드는 다음 작업을 수행합니다.

  • 새 컨테이너에 대한 배율 변환을 지정하는 두 개의 사각형을 만듭니다.

  • 새 그래픽 컨테이너를 열고 이전 컨테이너를 저장합니다.

  • 새 컨테이너의 크기 조정된 좌표에 빨간색 사각형을 채웁니다.

  • 새 컨테이너를 닫고 저장된 컨테이너를 복원합니다.

  • 저장된 컨테이너의 녹색 사각형(크기가 조정되지 않은 좌표)을 채웁니다.

그 결과 작은 빨간색 사각형의 기초가 되는 녹색 사각형이 생성됩니다.

private:
   void BeginContainerRectangleF( PaintEventArgs^ e )
   {
      // Define transformation for container.
      RectangleF srcRect = RectangleF(0.0F,0.0F,200.0F,200.0F);
      RectangleF destRect = RectangleF(100.0F,100.0F,150.0F,150.0F);

      // Begin graphics container.
      GraphicsContainer^ containerState = e->Graphics->BeginContainer( destRect, srcRect, GraphicsUnit::Pixel );

      // Fill red rectangle in container.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0.0F, 0.0F, 200.0F, 200.0F );

      // End graphics container.
      e->Graphics->EndContainer( containerState );

      // Fill untransformed rectangle with green.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), 0.0F, 0.0F, 200.0F, 200.0F );
   }
private void BeginContainerRectangleF(PaintEventArgs e)
{
    // Define transformation for container.
    RectangleF srcRect = new RectangleF(0.0F, 0.0F, 200.0F, 200.0F);
    RectangleF destRect = new RectangleF(100.0F, 100.0F, 150.0F, 150.0F);
             
    // Begin graphics container.
    GraphicsContainer containerState = e.Graphics.BeginContainer(
        destRect, srcRect,
        GraphicsUnit.Pixel);
             
    // Fill red rectangle in container.
    e.Graphics.FillRectangle(new SolidBrush(Color.Red), 0.0F, 0.0F, 200.0F, 200.0F);
             
    // End graphics container.
    e.Graphics.EndContainer(containerState);
             
    // Fill untransformed rectangle with green.
    e.Graphics.FillRectangle(new SolidBrush(Color.Green), 0.0F, 0.0F, 200.0F, 200.0F);
}
Private Sub BeginContainerRectangleF(ByVal e As PaintEventArgs)

    ' Define transformation for container.
    Dim srcRect As New RectangleF(0.0F, 0.0F, 200.0F, 200.0F)
    Dim destRect As New RectangleF(100.0F, 100.0F, 150.0F, 150.0F)

    ' Begin graphics container.
    Dim containerState As GraphicsContainer = _
    e.Graphics.BeginContainer(destRect, srcRect, GraphicsUnit.Pixel)

    ' Fill red rectangle in container.
    e.Graphics.FillRectangle(New SolidBrush(Color.Red), 0.0F, 0.0F, _
    200.0F, 200.0F)

    ' End graphics container.
    e.Graphics.EndContainer(containerState)

    ' Fill untransformed rectangle with green.
    e.Graphics.FillRectangle(New SolidBrush(Color.Green), 0.0F, 0.0F, _
    200.0F, 200.0F)
End Sub

설명

메서드와 함께 이 메서드를 EndContainer 사용하여 중첩된 그래픽 컨테이너를 만듭니다. 그래픽 컨테이너는 변환, 클리핑 영역 및 렌더링 속성과 같은 그래픽 상태를 유지합니다.

메서드BeginContainerGraphics 호출할 때 상태를 Graphics 보유하는 정보 블록이 스택에 배치됩니다. 메서드는 BeginContainer 해당 정보 블록을 식별하는 값을 반환 GraphicsContainer 합니다. 식별 개체를 메서드에 EndContainer 전달하면 정보 블록이 스택에서 제거되고 메서드 호출 당시 Graphics 의 상태로 복원 BeginContainer 하는 데 사용됩니다.

컨테이너를 중첩할 수 있습니다. 즉, 메서드를 호출하기 전에 메서드를 BeginContainer 여러 번 호출할 EndContainer 수 있습니다. 메서드를 BeginContainer 호출할 때마다 정보 블록이 스택에 배치되고 정보 블록에 대한 정보를 받 GraphicsContainer 습니다. 이러한 개체 중 하나를 메서드에 EndContainer 전달하면 해당 특정 개체를 반환한 메서드 호출 당시의 Graphics 상태로 반환됩니다BeginContainer.GraphicsContainer 해당 BeginContainer 메서드 호출에 의해 스택에 배치된 정보 블록은 스택에서 제거되고 해당 메서드 호출 후 BeginContainer 해당 스택에 배치된 모든 정보 블록도 제거됩니다.

메서드에 대한 호출은 Save 메서드 호출과 BeginContainer 동일한 스택에 정보 블록을 배치합니다. EndContainer 메서드 호출이 메서드 호출 BeginContainer 과 쌍을 Restore 이루는 것처럼 메서드 호출은 메서드 호출과 쌍을 이 Save 릅니다.

메서드를 EndContainer 호출할 때 메서드에 대한 해당 호출 Save 후 스택에 배치된 모든 정보 블록(BeginContainer메서드 또는 BeginContainer 메서드)이 스택에서 제거됩니다. 마찬가지로 메서드를 Restore 호출할 때 메서드에 대한 해당 호출 Save 후 스택에 배치된 모든 정보 블록(BeginContainer메서드 또는 Save 메서드)이 스택에서 제거됩니다.

이 메서드는 및 dstrect 매개 변수를 사용하여 새 그래픽 컨테이너에 대한 크기 조정 변환을 srcrect 지정합니다. 눈금은 적용 srcrect할 때 결과가 되는 변환과 dstrect같습니다.

메서드에 의해 BeginContainer 설정된 그래픽 상태에는 기본 그래픽 상태의 렌더링 품질이 포함됩니다. 메서드가 호출될 때 기존 렌더링 품질 상태가 기본값으로 다시 설정됩니다.

적용 대상