'创建圆角矩形
Public Sub RoundRectFrame(objEllipse As Object, Optional ByVal x3 As Long = 8 _
, Optional ByVal y3 As Long = 8)
Dim lngW As Long, lngH As Long
Dim hWndRet As Long
End Sub
3、用c#代码做的
using System;
using System.ComponentModel;
using System.Collections;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace WindowsApplication1
{
/// <summary>
/// Summary description for cilpButton.
/// </summary>
public class cilpButton : System.Windows.Forms.Button
{
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
base.OnPaint(e);
System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
path.AddEllipse(0,0, this.Width, this.Height);
this.Region = new Region(path);
}
'创建圆角矩形
Public Sub RoundRectFrame(objEllipse As Object, Optional ByVal x3 As Long = 8 _
, Optional ByVal y3 As Long = 8)
Dim lngW As Long, lngH As Long
Dim hWndRet As Long
End Sub
3、用c#代码做的
using System;
using System.ComponentModel;
using System.Collections;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace WindowsApplication1
{
/// <summary>
/// Summary description for cilpButton.
/// </summary>
public class cilpButton : System.Windows.Forms.Button
{
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
base.OnPaint(e);
System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
path.AddEllipse(0,0, this.Width, this.Height);
this.Region = new Region(path);
}
System.Drawing.Drawing2D.GraphicsPath buttonPath =
new System.Drawing.Drawing2D.GraphicsPath();
// Set a new rectangle to the same size as the button's
// ClientRectangle property.
System.Drawing.Rectangle newRectangle = roundButton.ClientRectangle;
// Decrease the size of the rectangle.
newRectangle.Inflate(-10, -10);
// Draw the button's border.
e.Graphics.DrawEllipse(System.Drawing.Pens.Black, newRectangle);
// Increase the size of the rectangle to include the border.
newRectangle.Inflate( 1, 1);
// Create a circle within the new rectangle.
buttonPath.AddEllipse(newRectangle);
//设置按钮的Region.
roundButton.Region = new System.Drawing.Region(buttonPath);