vb.net按鈕圖形大小 vb按鈕圖片配合按鈕大小

VB.NET picturebox 內(nèi)繪圖完圖形放大縮小移動(dòng) 鼠標(biāo)控制 。比較笨看了VB的代碼不明白 求解

。net 不用api就行

成都創(chuàng)新互聯(lián)專注于普安網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠(chéng)為您提供普安營(yíng)銷型網(wǎng)站建設(shè),普安網(wǎng)站制作、普安網(wǎng)頁(yè)設(shè)計(jì)、普安網(wǎng)站官網(wǎng)定制、重慶小程序開(kāi)發(fā)服務(wù),打造普安網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供普安網(wǎng)站排名全網(wǎng)營(yí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)方向

vb.net控件位置跟隨圖片框大小變化

以下代碼測(cè)試成功,圖片大小和位置改變后,標(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

vb.net 平面按鈕

本來(lái)有個(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

'離開(kāi)時(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)。

當(dāng)前名稱:vb.net按鈕圖形大小 vb按鈕圖片配合按鈕大小
本文網(wǎng)址:http://www.muchs.cn/article30/dohisso.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)品牌網(wǎng)站制作、微信小程序、網(wǎng)站制作、搜索引擎優(yōu)化、品牌網(wǎng)站設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

營(yíng)銷型網(wǎng)站建設(shè)