ControlPaint.DrawBorder 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在按钮样式的控件上绘制边框。
重载
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)
参数
- style
- ButtonBorderStyle
ButtonBorderStyle 值之一,它指定边框的样式。
示例
下面的代码示例演示如何使用其中 DrawBorder3D 一种方法。 若要运行此示例,请将以下代码粘贴到导入 System.Windows.Forms 和 System.Drawing 命名空间的窗体中。 确保窗体的事件 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)
参数
- leftWidth
- Int32
左边框的宽度。
- leftStyle
- ButtonBorderStyle
ButtonBorderStyle 值之一,它指定左边框的样式。
- topWidth
- Int32
上边框的宽度。
- topStyle
- ButtonBorderStyle
ButtonBorderStyle 值之一,它指定上边框的样式。
- rightWidth
- Int32
右边框的宽度。
- rightStyle
- ButtonBorderStyle
ButtonBorderStyle 值之一,它指定右边框的样式。
- bottomWidth
- Int32
下边框的宽度。
- bottomStyle
- ButtonBorderStyle
ButtonBorderStyle 值之一,它指定下边框的样式。
示例
下面的代码示例演示如何使用其中 DrawBorder3D 一种方法。 若要运行此示例,请将以下代码粘贴到导入 System.Windows.Forms 和 System.Drawing 命名空间的窗体中。 确保窗体的事件 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