次の方法で共有


ControlPaint.DrawBorder メソッド (Graphics, Rectangle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle)

ボタン スタイルのコントロールの輪郭を、指定したスタイル、色、および輪郭の幅を使用して、指定した範囲内の、指定したグラフィックスの表面に描画します。

Overloads Public Shared Sub DrawBorder( _
   ByVal graphics As Graphics, _   ByVal bounds As Rectangle, _   ByVal leftColor As Color, _   ByVal leftWidth As Integer, _   ByVal leftStyle As ButtonBorderStyle, _   ByVal topColor As Color, _   ByVal topWidth As Integer, _   ByVal topStyle As ButtonBorderStyle, _   ByVal rightColor As Color, _   ByVal rightWidth As Integer, _   ByVal rightStyle As ButtonBorderStyle, _   ByVal bottomColor As Color, _   ByVal bottomWidth As Integer, _   ByVal bottomStyle As ButtonBorderStyle _)
[C#]
public static void DrawBorder(Graphicsgraphics,Rectanglebounds,ColorleftColor,intleftWidth,ButtonBorderStyleleftStyle,ColortopColor,inttopWidth,ButtonBorderStyletopStyle,ColorrightColor,intrightWidth,ButtonBorderStylerightStyle,ColorbottomColor,intbottomWidth,ButtonBorderStylebottomStyle);
[C++]
public: static void DrawBorder(Graphics* graphics,Rectanglebounds,ColorleftColor,intleftWidth,ButtonBorderStyleleftStyle,ColortopColor,inttopWidth,ButtonBorderStyletopStyle,ColorrightColor,intrightWidth,ButtonBorderStylerightStyle,ColorbottomColor,intbottomWidth,ButtonBorderStylebottomStyle);
[JScript]
public static function DrawBorder(
   graphics : Graphics,bounds : Rectangle,leftColor : Color,leftWidth : int,leftStyle : ButtonBorderStyle,topColor : Color,topWidth : int,topStyle : ButtonBorderStyle,rightColor : Color,rightWidth : int,rightStyle : ButtonBorderStyle,bottomColor : Color,bottomWidth : int,bottomStyle : ButtonBorderStyle);

パラメータ

  • graphics
    描画する Graphics
  • bounds
    輪郭の大きさを表す Rectangle
  • leftColor
    左の輪郭の Color
  • leftWidth
    左の輪郭の幅。
  • leftStyle
    左端の境界線のスタイルを指定する ButtonBorderStyle 値の 1 つ。
  • topColor
    上の輪郭の Color
  • topWidth
    上の輪郭の幅。
  • topStyle
    上端の境界線のスタイルを指定する ButtonBorderStyle 値の 1 つ。
  • rightColor
    右の輪郭の Color
  • rightWidth
    右の輪郭の幅。
  • rightStyle
    右端の境界線のスタイルを指定する ButtonBorderStyle 値の 1 つ。
  • bottomColor
    下の輪郭の Color
  • bottomWidth
    左の輪郭の幅。
  • bottomStyle
    下端の境界線のスタイルを指定する ButtonBorderStyle 値の 1 つ。

使用例

[Visual Basic, C#] System.Windows.Forms.DrawBorder3D メソッドの中の 1 つを使用する方法を次のコード例に示します。この例を実行するには、次のコードをフォームに貼り付けます。このフォームは、 System.Windows.Forms 名前空間および System.Drawing 名前空間をインポートします。

 
' Handle the Form's Paint event to draw a 3D three-dimensional 
' raised border just inside the border of the frame.
Private Sub Form1_Paint(ByVal sender As Object, _
    ByVal e As PaintEventArgs) Handles MyBase.Paint

    Dim borderRectangle As Rectangle = Me.ClientRectangle
    borderRectangle.Inflate(-10, -10)
    ControlPaint.DrawBorder3D(e.Graphics, borderRectangle, _
        Border3DStyle.Raised)
End Sub

[C#] 
// Handle the Form's Paint event to draw a 3D three-dimensional 
// raised border just inside the border of the frame.
private void Form1_Paint(object sender, PaintEventArgs e)
{

    Rectangle borderRectangle = this.ClientRectangle;
    borderRectangle.Inflate(-10, -10);
    ControlPaint.DrawBorder3D(e.Graphics, borderRectangle, 
        Border3DStyle.Raised);
}

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

ControlPaint クラス | ControlPaint メンバ | System.Windows.Forms 名前空間 | ControlPaint.DrawBorder オーバーロードの一覧 | ButtonBorderStyle