VB.NET將恣意圖像文件設置為鼠標外形。本站提示廣大學習愛好者:(VB.NET將恣意圖像文件設置為鼠標外形)文章只能為提供參考,不一定能成為您想要的結果。以下是VB.NET將恣意圖像文件設置為鼠標外形正文
VB.NET代碼
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fd As OpenFileDialog = New OpenFileDialog()
fd.Filter = "圖像文件(*.jpg;*.gif;*.png)|*.jpg;*.gif;*.png"
If fd.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim fn As Image = Image.FromFile(fd.FileName)
Dim bitmap As New Bitmap(fn)
Dim handle As IntPtr = bitmap.GetHicon()
Dim myCursor As New Cursor(handle)
Me.Cursor = myCursor
End If
End Sub
代碼,以作備份。