ControlPaint.DrawBorder メソッド

定義

ボタン スタイルのコントロールの輪郭を描画します。

オーバーロード

DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle)

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

DrawBorder(Graphics, Rectangle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle)

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

DrawBorder(Graphics, Rectangle, Color, ButtonBorderStyle)

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

public:
 static void DrawBorder(System::Drawing::Graphics ^ graphics, System::Drawing::Rectangle bounds, System::Drawing::Color color, System::Windows::Forms::ButtonBorderStyle style);
public static void DrawBorder (System.Drawing.Graphics graphics, System.Drawing.Rectangle bounds, System.Drawing.Color color, System.Windows.Forms.ButtonBorderStyle style);
static member DrawBorder : System.Drawing.Graphics * System.Drawing.Rectangle * System.Drawing.Color * System.Windows.Forms.ButtonBorderStyle -> unit
Public Shared Sub DrawBorder (graphics As Graphics, bounds As Rectangle, color As Color, style As ButtonBorderStyle)

パラメーター

graphics
Graphics

描画する Graphics

bounds
Rectangle

輪郭の大きさを表す Rectangle

color
Color

輪郭の Color

style
ButtonBorderStyle

境界線のスタイルを指定する ButtonBorderStyle 値の 1 つ。

次のコード例では、いずれかのメソッドの使用方法を DrawBorder3D 示します。 この例を実行するには、 名前空間と System.Drawing 名前空間をインポートするフォームに次のコードをSystem.Windows.Forms貼り付けます。 フォーム Paint のイベントが、この例のイベント ハンドラーに関連付けられていることを確認します。

// Handle the Form's Paint event to draw a 3D three-dimensional 
// raised border just inside the border of the frame.
void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e )
{
   Rectangle borderRectangle = this->ClientRectangle;
   borderRectangle.Inflate(  -10, -10 );
   ControlPaint::DrawBorder3D( e->Graphics, borderRectangle, Border3DStyle::Raised );
}
// 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);
}
' 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

適用対象

DrawBorder(Graphics, Rectangle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle, Color, Int32, ButtonBorderStyle)

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

public:
 static void DrawBorder(System::Drawing::Graphics ^ graphics, System::Drawing::Rectangle bounds, System::Drawing::Color leftColor, int leftWidth, System::Windows::Forms::ButtonBorderStyle leftStyle, System::Drawing::Color topColor, int topWidth, System::Windows::Forms::ButtonBorderStyle topStyle, System::Drawing::Color rightColor, int rightWidth, System::Windows::Forms::ButtonBorderStyle rightStyle, System::Drawing::Color bottomColor, int bottomWidth, System::Windows::Forms::ButtonBorderStyle bottomStyle);
public static void DrawBorder (System.Drawing.Graphics graphics, System.Drawing.Rectangle bounds, System.Drawing.Color leftColor, int leftWidth, System.Windows.Forms.ButtonBorderStyle leftStyle, System.Drawing.Color topColor, int topWidth, System.Windows.Forms.ButtonBorderStyle topStyle, System.Drawing.Color rightColor, int rightWidth, System.Windows.Forms.ButtonBorderStyle rightStyle, System.Drawing.Color bottomColor, int bottomWidth, System.Windows.Forms.ButtonBorderStyle bottomStyle);
static member DrawBorder : System.Drawing.Graphics * System.Drawing.Rectangle * System.Drawing.Color * int * System.Windows.Forms.ButtonBorderStyle * System.Drawing.Color * int * System.Windows.Forms.ButtonBorderStyle * System.Drawing.Color * int * System.Windows.Forms.ButtonBorderStyle * System.Drawing.Color * int * System.Windows.Forms.ButtonBorderStyle -> unit
Public Shared Sub DrawBorder (graphics As Graphics, bounds As Rectangle, leftColor As Color, leftWidth As Integer, leftStyle As ButtonBorderStyle, topColor As Color, topWidth As Integer, topStyle As ButtonBorderStyle, rightColor As Color, rightWidth As Integer, rightStyle As ButtonBorderStyle, bottomColor As Color, bottomWidth As Integer, bottomStyle As ButtonBorderStyle)

パラメーター

graphics
Graphics

描画する Graphics

bounds
Rectangle

輪郭の大きさを表す Rectangle

leftColor
Color

左の輪郭の Color

leftWidth
Int32

左の輪郭の幅。

leftStyle
ButtonBorderStyle

左端の境界線のスタイルを指定する ButtonBorderStyle 値の 1 つ。

topColor
Color

上の輪郭の Color

topWidth
Int32

上の輪郭の幅。

topStyle
ButtonBorderStyle

上端の境界線のスタイルを指定する ButtonBorderStyle 値の 1 つ。

rightColor
Color

右の輪郭の Color

rightWidth
Int32

右の輪郭の幅。

rightStyle
ButtonBorderStyle

右端の境界線のスタイルを指定する ButtonBorderStyle 値の 1 つ。

bottomColor
Color

下の輪郭の Color

bottomWidth
Int32

下側境界線の幅。

bottomStyle
ButtonBorderStyle

下端の境界線のスタイルを指定する ButtonBorderStyle 値の 1 つ。

次のコード例では、いずれかのメソッドの使用方法を DrawBorder3D 示します。 この例を実行するには、 名前空間と System.Drawing 名前空間をインポートするフォームに次のコードをSystem.Windows.Forms貼り付けます。 フォーム Paint のイベントが、この例のイベント ハンドラーに関連付けられていることを確認します。

// Handle the Form's Paint event to draw a 3D three-dimensional 
// raised border just inside the border of the frame.
void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e )
{
   Rectangle borderRectangle = this->ClientRectangle;
   borderRectangle.Inflate(  -10, -10 );
   ControlPaint::DrawBorder3D( e->Graphics, borderRectangle, Border3DStyle::Raised );
}
// 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);
}
' 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

こちらもご覧ください

適用対象