WrapMode Enumeração

Definição

Especifica como uma textura ou gradiente é tilado quando é menor do que a área a preencher.

public enum class WrapMode
public enum WrapMode
type WrapMode = 
Public Enum WrapMode
Herança
WrapMode

Campos

Name Valor Description
Tile 0

Azulejos, o gradiente ou textura.

TileFlipX 1

Inverte a textura ou gradiente horizontalmente e depois aplica tiles na textura ou gradiente.

TileFlipY 2

Inverte a textura ou o gradiente verticalmente e depois aplica mosaicos na textura ou gradiente.

TileFlipXY 3

Inverte a textura ou gradiente horizontal e verticalmente e depois coloca a textura ou gradiente em mosaico.

Clamp 4

A textura ou gradiente não está em mosaico.

Exemplos

O exemplo de código seguinte demonstra como obter um novo bitmap usando o FromFile método. Também demonstra um TextureBrush e a WrapMode enumeração. Este exemplo foi concebido para ser usado com Windows Forms. Crie um formulário contendo um botão chamado Button2. Cole o código no formulário e associe o Button2_Click método ao evento do Click botão.

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

Observações

Os pincéis usam esta enumeração para determinar como as formas são preenchidas. Para ver exemplos dos efeitos que os WrapMode valores de enumeração têm numa imagem em mosaico, veja Como: Tile uma Forma com uma Imagem.

Aplica-se a

Ver também