当前位置导航:炫浪网>>网络学院>>编程开发>>Visual Basic教程

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?http://www.xvna.com;*.gif?http://www.xvna.com;*.png)|*.jpg?http://www.xvna.com;*.gif?http://www.xvna.com;*.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

代码,以作备份:

相关内容
赞助商链接