Results 1 to 10 of 10

Thread: .cur from resource file / memory stream

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2004
    Posts
    259

    .cur from resource file / memory stream

    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)
    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
    WITH .CUR: (runtime error)
    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 ---
    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.
    Last edited by Waxy; Apr 22nd, 2013 at 12:58 AM.
    ----------------------------------------------------

    Missing the days of GWBasic 1.1
    WaxyStudios.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width