次の方法で共有


ImageAttributes.SetWrapMode メソッド

定義

折り返しモードを設定します。

オーバーロード

SetWrapMode(WrapMode)

図形または図形の境界を越えてテクスチャを並べて表示する方法を決定するために使用するラップ モードを設定します。 テクスチャは、テクスチャが塗りつぶされている図形よりも小さい場合に塗りつぶすために、図形全体に並べて表示されます。

SetWrapMode(WrapMode, Color)

図形または図形の境界を越えてテクスチャを並べて表示する方法を決定するために使用するラップ モードと色を設定します。 テクスチャは、テクスチャが塗りつぶされている図形よりも小さい場合に塗りつぶすために、図形全体に並べて表示されます。

SetWrapMode(WrapMode, Color, Boolean)

図形または図形の境界を越えてテクスチャを並べて表示する方法を決定するために使用するラップ モードと色を設定します。 テクスチャは、テクスチャが塗りつぶされている図形よりも小さい場合に塗りつぶすために、図形全体に並べて表示されます。

SetWrapMode(WrapMode)

ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs

図形または図形の境界を越えてテクスチャを並べて表示する方法を決定するために使用するラップ モードを設定します。 テクスチャは、テクスチャが塗りつぶされている図形よりも小さい場合に塗りつぶすために、図形全体に並べて表示されます。

public:
 void SetWrapMode(System::Drawing::Drawing2D::WrapMode mode);
public void SetWrapMode (System.Drawing.Drawing2D.WrapMode mode);
member this.SetWrapMode : System.Drawing.Drawing2D.WrapMode -> unit
Public Sub SetWrapMode (mode As WrapMode)

パラメーター

mode
WrapMode

領域を並べて表示するためにイメージのコピーを繰り返し使用する方法を指定する WrapMode の要素。

次のコード例は Windows フォームで使用できるように設計されており、Paint イベント ハンドラーのパラメーターである PaintEventArgseが必要です。 このコードは、次のアクションを実行します。

  1. Circle3.jpg ファイル (赤で塗りつぶされた小さな円) から Image を開き、画面に描画します。

  2. ImageAttributes オブジェクトを作成し、WrapMode 列挙体を Tileに設定します。

  3. Circle3.jpg ファイルのイメージを使用して TextureBrush を作成します。

  4. 赤で塗りつぶされた小さな円で塗りつぶされた四角形を画面に描画します。

void SetWrapModeExample( PaintEventArgs^ e )
{
   // Create a filled, red circle, and save it to Circle3.jpg.
   Bitmap^ myBitmap = gcnew Bitmap( 50,50 );
   Graphics^ g = Graphics::FromImage( myBitmap );
   g->Clear( Color::White );
   g->FillEllipse( gcnew SolidBrush( Color::Red ), Rectangle(0,0,25,25) );
   myBitmap->Save( "Circle3.jpg" );

   // Create an Image object from the Circle3.jpg file, and draw it
   // to the screen.
   Image^ myImage = Image::FromFile( "Circle3.jpg" );
   e->Graphics->DrawImage( myImage, 20, 20 );

   // Set the wrap mode.
   ImageAttributes^ imageAttr = gcnew ImageAttributes;
   imageAttr->SetWrapMode( WrapMode::Tile );

   // Create a TextureBrush.
   Rectangle brushRect = Rectangle(0,0,25,25);
   TextureBrush^ myTBrush = gcnew TextureBrush( myImage,brushRect,imageAttr );

   // Draw to the screen a rectangle filled with red circles.
   e->Graphics->FillRectangle( myTBrush, 100, 20, 200, 200 );
}
private void SetWrapModeExample(PaintEventArgs e)
{
             
    // Create a filled, red circle, and save it to Circle3.jpg.
    Bitmap myBitmap = new Bitmap(50, 50);
    Graphics g = Graphics.FromImage(myBitmap);
    g.Clear(Color.White);
    g.FillEllipse(new SolidBrush(Color.Red),
        new Rectangle(0, 0, 25, 25));
    myBitmap.Save("Circle3.jpg");
             
    // Create an Image object from the Circle3.jpg file, and draw it
    // to the screen.
    Image myImage = Image.FromFile("Circle3.jpg");
    e.Graphics.DrawImage(myImage, 20, 20);
             
    // Set the wrap mode.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetWrapMode(WrapMode.Tile);
             
    // Create a TextureBrush.
    Rectangle brushRect = new Rectangle(0,0,25,25);
    TextureBrush myTBrush = new TextureBrush(myImage, brushRect, imageAttr);
             
    // Draw to the screen a rectangle filled with red circles.
    e.Graphics.FillRectangle(myTBrush, 100, 20, 200, 200);
}
Public Sub SetWrapModeExample(ByVal e As PaintEventArgs)

    ' Create a filled, red circle, and save it to Circle3.jpg.
    Dim myBitmap As New Bitmap(50, 50)
    Dim g As Graphics = Graphics.FromImage(myBitmap)
    g.Clear(Color.White)
    g.FillEllipse(New SolidBrush(Color.Red), New Rectangle(0, 0, _
    25, 25))
    myBitmap.Save("Circle3.jpg")

    ' Create an Image object from the Circle3.jpg file, and draw

    ' it to the screen.
    Dim myImage As Image = Image.FromFile("Circle3.jpg")
    e.Graphics.DrawImage(myImage, 20, 20)

    ' Set the wrap mode.
    Dim imageAttr As New ImageAttributes
    imageAttr.SetWrapMode(WrapMode.Tile)

    ' Create a TextureBrush.
    Dim brushRect As New Rectangle(0, 0, 25, 25)
    Dim myTBrush As New TextureBrush(myImage, brushRect, imageAttr)

    ' Draw to the screen a rectangle filled with red circles.
    e.Graphics.FillRectangle(myTBrush, 100, 20, 200, 200)
End Sub

注釈

SetWrapMode(WrapMode) メソッドの呼び出しは、SetWrapMode(WrapMode, Color) を呼び出し、color パラメーターの Color.Black を渡すことと同じです。 Color.Black は、レンダリングされたイメージの外側のピクセルの色を指定します。 この色は、mode パラメーターが Clamp に設定されていて、DrawImage メソッドに渡されるソース四角形がイメージ自体よりも大きい場合に表示されます。

適用対象

SetWrapMode(WrapMode, Color)

ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs

図形または図形の境界を越えてテクスチャを並べて表示する方法を決定するために使用するラップ モードと色を設定します。 テクスチャは、テクスチャが塗りつぶされている図形よりも小さい場合に塗りつぶすために、図形全体に並べて表示されます。

public:
 void SetWrapMode(System::Drawing::Drawing2D::WrapMode mode, System::Drawing::Color color);
public void SetWrapMode (System.Drawing.Drawing2D.WrapMode mode, System.Drawing.Color color);
member this.SetWrapMode : System.Drawing.Drawing2D.WrapMode * System.Drawing.Color -> unit
Public Sub SetWrapMode (mode As WrapMode, color As Color)

パラメーター

mode
WrapMode

領域を並べて表示するためにイメージのコピーを繰り返し使用する方法を指定する WrapMode の要素。

color
Color

レンダリングされたイメージの外側のピクセルの色を指定する ImageAttributes オブジェクト。 この色は、mode パラメーターが Clamp に設定されていて、DrawImage に渡されるソース四角形がイメージ自体よりも大きい場合に表示されます。

コード例については、SetWrapMode(WrapMode) メソッドを参照してください。

適用対象

SetWrapMode(WrapMode, Color, Boolean)

ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs
ソース:
ImageAttributes.cs

図形または図形の境界を越えてテクスチャを並べて表示する方法を決定するために使用するラップ モードと色を設定します。 テクスチャは、テクスチャが塗りつぶされている図形よりも小さい場合に塗りつぶすために、図形全体に並べて表示されます。

public:
 void SetWrapMode(System::Drawing::Drawing2D::WrapMode mode, System::Drawing::Color color, bool clamp);
public void SetWrapMode (System.Drawing.Drawing2D.WrapMode mode, System.Drawing.Color color, bool clamp);
member this.SetWrapMode : System.Drawing.Drawing2D.WrapMode * System.Drawing.Color * bool -> unit
Public Sub SetWrapMode (mode As WrapMode, color As Color, clamp As Boolean)

パラメーター

mode
WrapMode

領域を並べて表示するためにイメージのコピーを繰り返し使用する方法を指定する WrapMode の要素。

color
Color

レンダリングされたイメージの外側のピクセルの色を指定するカラー オブジェクト。 この色は、mode パラメーターが Clamp に設定されていて、DrawImage に渡されるソース四角形がイメージ自体よりも大きい場合に表示されます。

clamp
Boolean

このパラメーターは無効です。 falseに設定します。

コード例については、SetWrapMode(WrapMode) メソッドを参照してください。

適用対象