。net 不用api就行
成都創(chuàng)新互聯(lián)專注于普安網(wǎng)站建設服務及定制,我們擁有豐富的企業(yè)做網(wǎng)站經驗。 熱誠為您提供普安營銷型網(wǎng)站建設,普安網(wǎng)站制作、普安網(wǎng)頁設計、普安網(wǎng)站官網(wǎng)定制、重慶小程序開發(fā)服務,打造普安網(wǎng)絡公司原創(chuàng)品牌,更為您提供普安網(wǎng)站排名全網(wǎng)營銷落地服務。
縮放操作
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
鼠標滾輪事件 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基本上能實現(xiàn)這個情況,怎奈有個線框怎么也弄不掉。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也會好看一點。
當前名稱:vb.net按鈕圖形大小 vb按鈕圖片配合按鈕大小
本文網(wǎng)址:http://www.chinadenli.net/article30/dohisso.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供用戶體驗、品牌網(wǎng)站制作、微信小程序、網(wǎng)站制作、搜索引擎優(yōu)化、品牌網(wǎng)站設計
聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)