英語で読む

次の方法で共有


WrapMode 列挙型

定義

テクスチャまたはグラデーションが塗りつぶし対象の領域よりも小さい場合の、並べ方を指定します。

C#
public enum WrapMode
継承
WrapMode

フィールド

名前 説明
Clamp 4

グラデーションまたはテクスチャは並べて表示されません。

Tile 0

グラデーションまたはテクスチャを並べて表示します。

TileFlipX 1

テクスチャまたはグラデーションを水平方向に反転し、それを並べて表示します。

TileFlipXY 3

テクスチャまたはグラデーションを水平および垂直方向に反転し、それを並べて表示します。

TileFlipY 2

テクスチャまたはグラデーションを垂直方向に反転し、それを並べて表示します。

次のコード例では、 メソッドを使用して新しいビットマップを取得する方法を FromFile 示します。 また、 と 列挙もWrapModeTextureBrushします。 この例は、Windows フォームで使用するように設計されています。 という名前Button2のボタンを含むフォームをCreateします。 コードをフォームに貼り付け、 メソッドを Button2_Click ボタンの Click イベントに関連付けます。

C#
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.");
    }
}

注釈

ブラシは、この列挙体を使用して、図形の塗りつぶし方法を決定します。 列挙値がタイルイメージに及ぼす影響 WrapMode の例については、「 How to: Tile a Shape with an Image」を参照してください。

適用対象

製品 バージョン
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

こちらもご覧ください