大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
。net 不用api就行
成都创新互联专注于普安网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供普安营销型网站建设,普安网站制作、普安网页设计、普安网站官网定制、重庆小程序开发服务,打造普安网络公司原创品牌,更为您提供普安网站排名全网营销落地服务。
缩放操作
Function 缩放(ByVal bitmap As Bitmap, ByVal 倍数 As Single) As Bitmap
Dim w As Integer = bitmap.Width * 倍数
Dim h As Integer = bitmap.Height * 倍数
Dim tem As New Bitmap(w, h)
Dim g As Graphics = Graphics.FromImage(tem)
g.DrawImage(bitmap, New Rectangle(0, 0, w, h), New Rectangle(0, 0, bitmap.Width, bitmap.Height), GraphicsUnit.Pixel)
g.Dispose()
Return tem
End Function
鼠标滚轮事件 MouseWheel
MouseEventArgs.Delta 值可以判断滚动方向
以下代码测试成功,图片大小和位置改变后,标签控件依然在这个点上。
Dim px, py, lx, ly As Integer
Private Sub PictureBox1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.Resize
If px 0 And py 0 Then
Label1.Location = New Point(PictureBox1.Size.Width / px * lx, PictureBox1.Size.Height / py * ly)
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
px = PictureBox1.Size.Width
py = PictureBox1.Size.Height
lx = Label1.Location.X
ly = Label1.Location.Y
End Sub
本来有个属性FlatStyle设置为Popup基本上能实现这个情况,怎奈有个线框怎么也弄不掉。FlatAppearance.BorderSize设置为0不起作用,只对Flat有用,所以用代码在Flat和Popup两种风格之间切换。
'在鼠标进入时设置为浮雕风格
Private Sub Button1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseEnter
Button1.FlatStyle = FlatStyle.Popup
End Sub
'离开时设置为平面风格,这样像标签一样只剩下文字,当然要FlatAppearance.BorderSize设置为0
Private Sub Button1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseLeave
Button1.FlatStyle = FlatStyle.Flat
End Sub
'另外把UseVisualStyleBackColor 设置为 False也会好看一点。