熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

VB.NET將任意圖像文件設置為鼠標形狀

2022-06-13   來源: .NET編程 

  VBNET 代碼
Private Sub Button_Click(ByVal sender As SystemObject ByVal e As SystemEventArgs) Handles ButtonClick 
    Dim fd As OpenFileDialog = New OpenFileDialog() 
    fdFilter = 圖像文件(*jpg;*gif;*png)|*jpg;*gif;*png
    If fdShowDialog() = WindowsFormsDialogResultOK Then
        Dim fn As Image = ImageFromFile(fdFileName) 
        Dim bitmap As New Bitmap(fn) 
        Dim handle As IntPtr = bitmapGetHicon() 
        Dim myCursor As New Cursor(handle) 
        MeCursor = myCursor 
    End If
End Sub

  代碼以作備份


From:http://tw.wingwit.com/Article/program/net/201311/13396.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.