大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
'我给你找到了,设置region属性就可
我们提供的服务有:网站制作、做网站、微信公众号开发、网站优化、网站认证、平房ssl等。为成百上千企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的平房网站制作公司
Private Sub PictureBox1_DoubleClick(sender As System.Object, e As System.EventArgs) Handles PictureBox1.DoubleClick
If PictureBox1.Region Is Nothing Then
Dim path As New System.Drawing.Drawing2D.GraphicsPath
path.AddEllipse(0, 0, 200, 200)
PictureBox1.Region = New Region(path)
Else
PictureBox1.Region = Nothing
End If
End Sub
'这个双击图片框使其变形,通过GraphicsPath对象可以作出各种形态来,比如可作出文字形状
Dim stringText As String = "我是谁"
Dim family As New FontFamily("Arial")
Dim myfontStyle As Integer = CInt(FontStyle.Italic)
Dim emSize As Integer = 86
Dim origin As New Point(20, 20)
Dim format As StringFormat = StringFormat.GenericDefault
path.AddString(stringText, family, myfontStyle, emSize, _
origin, format)
PictureBox1.Region = New Region(path)
新建一个Winform,拖两个图片框。图片框1在设计器中选择一个图片(尺寸在图片框容纳为佳)。如下代码测试通过:
private void button1_Click(object sender, EventArgs e)
{
Image img1 = this.pictureBox1.Image;
Image img2 = CropToCircle(img1);
this.pictureBox2.Image = img2;
}
public Image CropToCircle(Image img1)
{
Image img2 = new Bitmap(img1.Width, img1.Height,
img1.PixelFormat);
Graphics g = Graphics.FromImage(img2);
using (Brush br =
new SolidBrush(SystemColors.Control))//背景色
{
g.FillRectangle(br, 0, 0,
img2.Width, img2.Height);
}
GraphicsPath path = new GraphicsPath();
path.AddEllipse(0, 0, img2.Width, img2.Height);
g.SetClip(path);
g.DrawImage(img1, 0, 0);
return img2;
}
这个简单.
加入一个图片框:picture1.
一个命今按钮:command1.
按钮的单击事件在图片框里画图:
Private Sub Command1_Click()
Picture1.Circle (600, 800), 500, vbRed '画圆
Picture1.Line (300, 400)-(1700, 1800), vbBlue '画线
Picture1.Line (600, 500)-(600, 1500), vbGreen '下面四项都是画矩形的
Picture1.Line (600, 1500)-(2500, 1500), vbGreen
Picture1.Line (2500, 1500)-(2500, 500), vbGreen
Picture1.Line (2500, 500)-(600, 500), vbGreen
End Sub
vb.net 怎么来回切换图片?1、添加控件Picturebox1和控件Timer1,将Timer1的Interval属性改为1000(即1秒),Enabled属性改为True
2、假设你要循环切换4张图片,你可以添加如下代码即可实现:
Dim a As Integer = 0
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If a = 4 Then
a = 0
Else
a = a + 1
End If
If a = 0 Then Me.PictureBox1.Image = Image.FromFile("1.jpg")
If a = 1 Then Me.PictureBox1.Image = Image.FromFile("2.jpg")
If a = 2 Then Me.PictureBox1.Image = Image.FromFile("3.jpg")
If a = 3 Then Me.PictureBox1.Image = Image.FromFile("4.jpg")
End Sub
可以
做一个ocx控件,思路如下:用api函数做一个圆形窗体,在里面放置按钮或者图片框,将窗体的属性绑定到按钮或者图片框的属性,打包生成ocx控件,就成为你想要的圆形按钮了
如果嫌麻烦,可以直接下一个这样的控件,网上很多的