i'm trying to add custom mouse icons to my app.
but i can't seem to do it.
currently, everything i find on the internet says this code works:
Code:Dim ms As New System.IO.MemoryStream(My.Resources.MouseCursor) Me.Cursor = New Cursor(ms)
but it gives me an error:
WITH PNG: (compile error)
WITH .CUR: (runtime error)Code:Error 2 Overload resolution failed because no accessible 'New' can be called with these arguments: 'Public Sub New(buffer() As Byte)': Value of type 'System.Drawing.Bitmap' cannot be converted to '1-dimensional array of Byte'. 'Public Sub New(capacity As Integer)': Value of type 'System.Drawing.Bitmap' cannot be converted to 'Integer'. E:\Users\John Doe\documents\visual studio 2010\Projects\UN Client\UN Client\Form1.vb 388 13 UNClient
if someone could explain to me how to use .cur or .png my.resources files as custom mouse cursors then it would be greatly appreciated.Code:See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.ArgumentException: Image format is not valid. The image file may be corrupted. Parameter name: stream ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A01E1 (CTL_E_INVALIDPICTURE) at System.Windows.Forms.UnsafeNativeMethods.IPersistStream.Load(IStream pstm) at System.Windows.Forms.Cursor.LoadPicture(IStream stream) --- End of inner exception stack trace ---




Reply With Quote