。net 不用api就行
成都創(chuàng)新互聯(lián)專注于普安網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供普安營銷型網(wǎng)站建設(shè),普安網(wǎng)站制作、普安網(wǎng)頁設(shè)計(jì)、普安網(wǎng)站官網(wǎng)定制、重慶小程序開發(fā)服務(wù),打造普安網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供普安網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
縮放操作
Function 縮放(ByVal bitmap As Bitmap, ByVal 倍數(shù) As Single) As Bitmap
Dim w As Integer = bitmap.Width * 倍數(shù)
Dim h As Integer = bitmap.Height * 倍數(shù)
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
鼠標(biāo)滾輪事件 MouseWheel
MouseEventArgs.Delta 值可以判斷滾動(dòng)方向
以下代碼測試成功,圖片大小和位置改變后,標(biāo)簽控件依然在這個(gè)點(diǎn)上。
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
本來有個(gè)屬性FlatStyle設(shè)置為Popup基本上能實(shí)現(xiàn)這個(gè)情況,怎奈有個(gè)線框怎么也弄不掉。FlatAppearance.BorderSize設(shè)置為0不起作用,只對(duì)Flat有用,所以用代碼在Flat和Popup兩種風(fēng)格之間切換。
'在鼠標(biāo)進(jìn)入時(shí)設(shè)置為浮雕風(fēng)格
Private Sub Button1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseEnter
Button1.FlatStyle = FlatStyle.Popup
End Sub
'離開時(shí)設(shè)置為平面風(fēng)格,這樣像標(biāo)簽一樣只剩下文字,當(dāng)然要FlatAppearance.BorderSize設(shè)置為0
Private Sub Button1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseLeave
Button1.FlatStyle = FlatStyle.Flat
End Sub
'另外把UseVisualStyleBackColor 設(shè)置為 False也會(huì)好看一點(diǎn)。