다음을 통해 공유


TextureBrush.WrapMode 속성

정의

WrapMode 개체의 랩 모드를 나타내는 TextureBrush 열거형을 가져오거나 설정합니다.

public:
 property System::Drawing::Drawing2D::WrapMode WrapMode { System::Drawing::Drawing2D::WrapMode get(); void set(System::Drawing::Drawing2D::WrapMode value); };
public System.Drawing.Drawing2D.WrapMode WrapMode { get; set; }
member this.WrapMode : System.Drawing.Drawing2D.WrapMode with get, set
Public Property WrapMode As WrapMode

속성 값

WrapMode 개체를 사용하여 그린 채우기가 바둑판식으로 배열되는 방법을 지정하는 LinearGradientBrush 열거형입니다.

예제

다음 코드 예제에서는 메서드를 사용하여 FromFile 새 비트맵을 가져오는 방법을 보여 줍니다. 또한 속성 및 열거형을 WrapMode 보여 WrapMode 줍니다.

이 예제는 Windows Forms 함께 사용하도록 설계되었습니다. Button2라는 단추가 포함된 양식을 Create. 코드를 양식에 붙여넣고 Button2_Click 메서드를 단추의 Click 이벤트와 연결합니다.

private:
   void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      try
      {
         Bitmap^ image1 = dynamic_cast<Bitmap^>(Image::FromFile( "C:\\Documents and Settings\\"
         "All Users\\Documents\\My Music\\music.bmp", true ));
         TextureBrush^ texture = gcnew TextureBrush( image1 );
         texture->WrapMode = System::Drawing::Drawing2D::WrapMode::Tile;
         Graphics^ formGraphics = this->CreateGraphics();
         formGraphics->FillEllipse( texture, RectangleF(90.0F,110.0F,100,100) );
         delete formGraphics;
      }
      catch ( System::IO::FileNotFoundException^ ) 
      {
         MessageBox::Show( "There was an error opening the bitmap."
         "Please check the path." );
      }
   }
private void Button2_Click(System.Object sender, System.EventArgs e)
{
    try
    {
        Bitmap image1 = (Bitmap) Image.FromFile(@"C:\Documents and Settings\" +
            @"All Users\Documents\My Music\music.bmp", true);

        TextureBrush texture = new TextureBrush(image1);
        texture.WrapMode = System.Drawing.Drawing2D.WrapMode.Tile;
        Graphics formGraphics = this.CreateGraphics();
        formGraphics.FillEllipse(texture, 
            new RectangleF(90.0F, 110.0F, 100, 100));
        formGraphics.Dispose();
    }
    catch(System.IO.FileNotFoundException)
    {
        MessageBox.Show("There was an error opening the bitmap." +
            "Please check the path.");
    }
}
Private Sub Button2_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button2.Click
    Try
        Dim image1 As Bitmap = _
            CType(Image.FromFile("C:\Documents and Settings\" _
            & "All Users\Documents\My Music\music.bmp", True), Bitmap)

        Dim texture As New TextureBrush(image1)
        texture.WrapMode = Drawing2D.WrapMode.Tile
        Dim formGraphics As Graphics = Me.CreateGraphics()
        formGraphics.FillEllipse(texture, _
            New RectangleF(90.0F, 110.0F, 100, 100))
        formGraphics.Dispose()

    Catch ex As System.IO.FileNotFoundException
        MessageBox.Show("There was an error opening the bitmap." _
            & "Please check the path.")
    End Try

End Sub

적용 대상