Display a custom animated mouse or color icon (vb.net)

Source: Internet
Author: User
Tags modify
Show

'//
'//Show custom animated mouse or color icon
'//According to "Mencius E chapter" of the column C # code http://blog.csdn.net/net_lover/archive/2004/10/22/146575.aspx
'//

' Imports System.Runtime.InteropServices
Imports System.Reflection
Public Class Form1
Inherits System.Windows.Forms.Form

#Region "code generated by the Windows forms Designer"

Public Sub New ()
MyBase.New ()

' This call is required by the Windows Forms Designer.
InitializeComponent ()

' Add any initialization after the InitializeComponent () call

End Sub

' Form overrides dispose to clean up the list of components.
Protected Overloads Overrides Sub Dispose (ByVal disposing as Boolean)
If disposing Then
If not (components are nothing) Then
Components. Dispose ()
End If
End If
Mybase.dispose (disposing)
End Sub

' Required by the Windows Forms Designer
Private Components as System.ComponentModel.IContainer

' NOTE: The following procedure is required by the Windows Forms Designer
' You can use the Windows Forms Designer to modify this procedure.
' Do not modify it using the Code Editor.
Friend WithEvents Savedlg as System.Windows.Forms.SaveFileDialog
<system.diagnostics.debuggerstepthrough () > Private Sub InitializeComponent ()
Me.savedlg = New System.Windows.Forms.SaveFileDialog
'
' Form1
'
Me.autoscalebasesize = New System.Drawing.Size (6, 14)
Me.clientsize = New System.Drawing.Size (360, 213)
Me.Name = "Form1"
Me.Text = "Form1"

End Sub

#End Region

Declare Function loadcursorfromfile Lib "user32" Alias "Loadcursorfromfilea" _
(ByVal lpFileName as String) As IntPtr

Private Sub Form1_Load (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles MyBase.Load
Dim MyCursor as New Cursor (Cursor.Current.Handle)
' Dinosau2.ani for Windows with its own cursor:
Dim Colorcursorhandle as IntPtr = Loadcursorfromfile (". \dinosau2.ani ")

Mycursor.gettype (). InvokeMember ("Handle", BindingFlags.Public Or _
BindingFlags.NonPublic or BindingFlags.Instance or Bindingflags.setfield, _
Nothing, MyCursor, New Object () {colorcursorhandle}) '

Me.cursor = MyCursor
End Sub

End Class



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.