WrapMode Wyliczenie

Definicja

Określa, jak tekstura lub gradient jest kafelków, gdy jest mniejszy niż obszar, który jest wypełniany.

public enum class WrapMode
public enum WrapMode
type WrapMode = 
Public Enum WrapMode
Dziedziczenie
WrapMode

Pola

Clamp 4

Tekstura lub gradient nie są kafelkami.

Tile 0

Kafelki gradientu lub tekstury.

TileFlipX 1

Odwraca teksturę lub gradient w poziomie, a następnie kafelki tekstury lub gradientu.

TileFlipXY 3

Odwraca teksturę lub gradient w poziomie i w pionie, a następnie kafelki tekstury lub gradientu.

TileFlipY 2

Odwraca teksturę lub gradient pionowo, a następnie kafelki tekstury lub gradientu.

Przykłady

W poniższym przykładzie kodu pokazano, jak uzyskać nową mapę bitową przy użyciu FromFile metody . Demonstruje TextureBrush on również wyliczenie i WrapMode . Ten przykład jest przeznaczony do użycia z Windows Forms. Utwórz formularz zawierający przycisk o nazwie Button2. Wklej kod do formularza i skojarz metodę Button2_Click ze zdarzeniem przycisku 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

Uwagi

Pędzle używają tego wyliczenia, aby określić sposób wypełniania kształtów. Aby zapoznać się z przykładami efektówWrapMode, jakie mają wartości wyliczenia na obrazie kafelkowym, zobacz How to: Tile a Shape with an Image (Jak: kafelek kształtu z obrazem).

Dotyczy

Zobacz też