ImageAttributes.SetWrapMode メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ラップ モードを設定します。
オーバーロード
SetWrapMode(WrapMode) |
形状全体、または形状の境界上にテクスチャを並べて表示する方法を決定するために使用されるラップ モードを設定します。 テクスチャで塗りつぶす形状がそのテクスチャより小さい場合、テクスチャは形状の境界をはみだして表示されます。 |
SetWrapMode(WrapMode, Color) |
形状全体、または形状の境界上にテクスチャを並べて表示する方法を決定するために使用される、ラップ モードおよび色を指定します。 テクスチャで塗りつぶす形状がそのテクスチャより小さい場合、テクスチャは形状の境界をはみだして表示されます。 |
SetWrapMode(WrapMode, Color, Boolean) |
形状全体、または形状の境界上にテクスチャを並べて表示する方法を決定するために使用される、ラップ モードおよび色を指定します。 テクスチャで塗りつぶす形状がそのテクスチャより小さい場合、テクスチャは形状の境界をはみだして表示されます。 |
SetWrapMode(WrapMode)
形状全体、または形状の境界上にテクスチャを並べて表示する方法を決定するために使用されるラップ モードを設定します。 テクスチャで塗りつぶす形状がそのテクスチャより小さい場合、テクスチャは形状の境界をはみだして表示されます。
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)
パラメーター
例
次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgse
です。 コードは、次のアクションを実行します。
Circle3.jpg ファイル (赤で塗りつぶされた小さな円) から を Image 開き、画面に描画します。
オブジェクトを ImageAttributes 作成し、 列挙を WrapMode に Tile設定します。
TextureBrushCircle3.jpg ファイルからイメージを使用して を作成します。
赤で塗りつぶされた小さな円で塗りつぶされた四角形を画面に描画します。
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.Blackcolor
と同じです。 Color.Black は、レンダリングされたイメージの外側のピクセルの色を指定します。 この色は、mode パラメーターが に設定されていて、メソッドにClampDrawImage渡されるソース四角形がイメージ自体よりも大きい場合に表示されます。
適用対象
SetWrapMode(WrapMode, Color)
形状全体、または形状の境界上にテクスチャを並べて表示する方法を決定するために使用される、ラップ モードおよび色を指定します。 テクスチャで塗りつぶす形状がそのテクスチャより小さい場合、テクスチャは形状の境界をはみだして表示されます。
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)
パラメーター
- color
- Color
表示イメージの外側のピクセルの色を指定する ImageAttributes オブジェクト。 モード パラメーターが Clamp に設定され、DrawImage に渡されたソース四角形がそのイメージ自体より大きい場合に、この色が表示されます。
例
コード例については、 メソッドを SetWrapMode(WrapMode) 参照してください。
適用対象
SetWrapMode(WrapMode, Color, Boolean)
形状全体、または形状の境界上にテクスチャを並べて表示する方法を決定するために使用される、ラップ モードおよび色を指定します。 テクスチャで塗りつぶす形状がそのテクスチャより小さい場合、テクスチャは形状の境界をはみだして表示されます。
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)
パラメーター
- color
- Color
表示イメージの外側のピクセルの色を指定する Color オブジェクト。 モード パラメーターが Clamp に設定され、DrawImage に渡されたソース四角形がそのイメージ自体より大きい場合に、この色が表示されます。
- clamp
- Boolean
このパラメーターは何も作用しません。 false
に設定します。
例
コード例については、 メソッドを SetWrapMode(WrapMode) 参照してください。
適用対象
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示