? vb.net亚博优惠活动之图形控件 亚博优惠活动,亚博体育网页版,亚博app怎么下载「官网直营」
VB.net 2010 视频亚博优惠活动 VB.net 2010 视频亚博优惠活动 VB.net 2010 视频亚博优惠活动
SQL Server 2008 视频亚博优惠活动 c#入门经典亚博优惠活动 Visual Basic从门到精通视频亚博优惠活动
  • vb.net亚博优惠活动之图形控件

  • 2015-01-17 22:49 来源:未知
图形控件(相关vb.net亚博优惠活动)
Picturebox:图片框
作用:加载图片与图片处理。
常用属性:
Image:加载图形.
Sizemode:设置图片的显示格式.有4个可选项:
Normal—默认值,在左上角显示.
Stretchimage图片随框的大小而自动缩放,总显示完整
Autosize—框根据图片的大小而大小变化.
Centerimage—图片在框中居中显示.
应用见,图片框的sizemode属性
程序如下:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
??????? PictureBox1.SizeMode = PictureBoxSizeMode.Normal
??? End Sub
?
??? Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
??????? PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
??? End Sub
?
??? Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
??????? PictureBox1.SizeMode = PictureBoxSizeMode.CenterImage
??? End Sub
?
??? Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
??????? PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize
??? End Sub
Imagelist:图片列表
作用:加载图片,以备其它控件使用。
常用属性:
Colordepth:颜色深度,此值越大图像越清晰,使用时要先设置此值,然后加载图片.如果加载过了图片再设置此项则已不起作用了.
Imagesize:图像大小
Images:图像排列,依序装入图片,序号从0开始.
综合应用:
练习:制作一个可以浏览图片的软件。
见,图片浏览软件.
3:制作一个可以加载图片、交换图片及图片缩放处理的软件,见加载交换图片。[实验报告24]
程序为:
加载图片部分:
Public Class Form1
??? Private Sub Button1.Click
??????? 'PictureBox1.Image = ImageList1.Images(0)
??????? 'PictureBox2.Image = ImageList1.Images(1)
??????? PictureBox1.Image = Image.FromFile("g:\1.jpg")
??????? PictureBox2.Image = Image.FromFile("g:\2.jpg")
??? End Sub
交换图片部分:
??? Private Sub Button2_Click
??????? PictureBox3.Image = PictureBox1.Image
??????? PictureBox1.Image = PictureBox2.Image
??????? PictureBox2.Image = PictureBox3.Image
??????? PictureBox3.Image = Nothing
??? End Sub
缩放部分的程序:
Private Sub Button4_Click
??????? PictureBox1.Width = PictureBox1.Width - 30
??????? PictureBox1.Height = PictureBox1.Height - 30
??? End Sub
?
??? Private Sub Button5_Click
??????? PictureBox1.Width = PictureBox1.Width + 30
??????? PictureBox1.Height = PictureBox1.Height + 30
??? End Sub
??? Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
??????? End
??? End Sub
End Class
说明:加载图片有两种方法:
A、借助imagelist提供的图片,如:PictureBox1.Image = ImageList1.Images(0)
b、用fromfile方法,如picturebox1.image=image.fromfile(“h:\2.jpg”)
panel面板:是一个图片框(picturebox)的容器,它可以带滚动条,常用的设置为:
将picturebox放置在panel上,然后将picturebox的缩放模式,设置为autosize,将panel的autoscroll设置为真。程序见,panel面版与picturebox
相关亚博优惠活动