Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. ImageList control in Compact Framework.

ImageList control in Compact Framework.

Scheduled Pinned Locked Moved Mobile
helpquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hurricane3000
    wrote on last edited by
    #1

    Hi all! In a my Compact Framework application that I'm developing using V.S. 2005 and VB, I need to choose a .bmp image file. If I do this work using the "classic" OpenFileDialog, all is OK and easy, but I desire to choose the file directly from a list of icons instead from the FileName. What control allow to do it? ImageList, ListView or ListBox? I tryed to use both together ImageList and ListView, but I encoutered in its use some limitations respect .Framework possibilities. The below line produces an error because the property "FromFile" is not present in Compact Framework and then I am not able to assign the string path-filename of image I want add in ImageList1. I tryed other ways but without success. ImageList1.Images.Add(Image.FromFile("image-path")) Thanks for help

    F 1 Reply Last reply
    0
    • H Hurricane3000

      Hi all! In a my Compact Framework application that I'm developing using V.S. 2005 and VB, I need to choose a .bmp image file. If I do this work using the "classic" OpenFileDialog, all is OK and easy, but I desire to choose the file directly from a list of icons instead from the FileName. What control allow to do it? ImageList, ListView or ListBox? I tryed to use both together ImageList and ListView, but I encoutered in its use some limitations respect .Framework possibilities. The below line produces an error because the property "FromFile" is not present in Compact Framework and then I am not able to assign the string path-filename of image I want add in ImageList1. I tryed other ways but without success. ImageList1.Images.Add(Image.FromFile("image-path")) Thanks for help

      F Offline
      F Offline
      funklet
      wrote on last edited by
      #2

      You could try this Dim b as bitmap = new bitmap("image-path") imagelist1.images.add(b) b.Dispose() If you dim a bitmap you must dispose of it when you have finished. Hope this helps.

      H 1 Reply Last reply
      0
      • F funklet

        You could try this Dim b as bitmap = new bitmap("image-path") imagelist1.images.add(b) b.Dispose() If you dim a bitmap you must dispose of it when you have finished. Hope this helps.

        H Offline
        H Offline
        Hurricane3000
        wrote on last edited by
        #3

        Hi Funklet, Previously I already tried your suggest, but now I tried again: Dim Bmp As Bitmap = New Bitmap("\Storage Card\Agip.bmp") ImageList1.Images.Add(Bmp) Bmp.Dispose() When I launck the appl. through simulator, V.S. 2005 stop the running, and return me these series of Error: 1) - In Immediate Window: A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll A first chance exception of type 'System.NullReferenceException' occurred in System.Windows.Forms.dll 2) - In Form2.Designer.vb at row: Me.ImageList1.Images.Add(CType(resources.GetObject("resource"), System.Drawing.Image)): System.NullReferenceException was unhandled Message="NullReferenceException" StackTrace: at ImageCollection.Add() at TrackPlotter.Form2.InitializeComponent() at TrackPlotter.Form2..ctor() at System.Reflection.RuntimeConstructorInfo.InternalInvoke() at System.Reflection.RuntimeConstructorInfo.Invoke() at System.Reflection.ConstructorInfo.Invoke() at System.Activator.CreateInstance() at MyForms.Create__Instance__() at MyForms.get_Form2() at TrackPlotter.Form1.Button1_Click() at System.Windows.Forms.Control.OnClick() at System.Windows.Forms.Button.OnClick() at System.Windows.Forms.ButtonBase.WnProc() at System.Windows.Forms.Control._InternalWnProc() at Microsoft.AGL.Forms.EVL.EnterMainLoop() at System.Windows.Forms.Application.Run() at TrackPlotter.Form1.Main() And suggest me: 1) Use the "New" Keyword to create an Object Instance. 2) Check to determine if the Object is Null before calling the metod. 3) Get the General Help for this exception.

        F 1 Reply Last reply
        0
        • H Hurricane3000

          Hi Funklet, Previously I already tried your suggest, but now I tried again: Dim Bmp As Bitmap = New Bitmap("\Storage Card\Agip.bmp") ImageList1.Images.Add(Bmp) Bmp.Dispose() When I launck the appl. through simulator, V.S. 2005 stop the running, and return me these series of Error: 1) - In Immediate Window: A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll A first chance exception of type 'System.NullReferenceException' occurred in System.Windows.Forms.dll 2) - In Form2.Designer.vb at row: Me.ImageList1.Images.Add(CType(resources.GetObject("resource"), System.Drawing.Image)): System.NullReferenceException was unhandled Message="NullReferenceException" StackTrace: at ImageCollection.Add() at TrackPlotter.Form2.InitializeComponent() at TrackPlotter.Form2..ctor() at System.Reflection.RuntimeConstructorInfo.InternalInvoke() at System.Reflection.RuntimeConstructorInfo.Invoke() at System.Reflection.ConstructorInfo.Invoke() at System.Activator.CreateInstance() at MyForms.Create__Instance__() at MyForms.get_Form2() at TrackPlotter.Form1.Button1_Click() at System.Windows.Forms.Control.OnClick() at System.Windows.Forms.Button.OnClick() at System.Windows.Forms.ButtonBase.WnProc() at System.Windows.Forms.Control._InternalWnProc() at Microsoft.AGL.Forms.EVL.EnterMainLoop() at System.Windows.Forms.Application.Run() at TrackPlotter.Form1.Main() And suggest me: 1) Use the "New" Keyword to create an Object Instance. 2) Check to determine if the Object is Null before calling the metod. 3) Get the General Help for this exception.

          F Offline
          F Offline
          funklet
          wrote on last edited by
          #4

          I'm not sure how you are including the image in your project but I would use 'Add Existing Item' to add the image to your project and ensure 'Copy Always' or 'Copy If Newer' is in the properties of the file. Also consider using:

          ImageList1.Images.Add(new Bitmap("\Program Files\(Your Project Name)\Agip.bmp))

          This way you can eliminate other factors such as a problem with the Storage Card... You may need to dispose of the Bitmaps when the form is disposed rather than immediately... Hope this helps.

          H 1 Reply Last reply
          0
          • F funklet

            I'm not sure how you are including the image in your project but I would use 'Add Existing Item' to add the image to your project and ensure 'Copy Always' or 'Copy If Newer' is in the properties of the file. Also consider using:

            ImageList1.Images.Add(new Bitmap("\Program Files\(Your Project Name)\Agip.bmp))

            This way you can eliminate other factors such as a problem with the Storage Card... You may need to dispose of the Bitmaps when the form is disposed rather than immediately... Hope this helps.

            H Offline
            H Offline
            Hurricane3000
            wrote on last edited by
            #5

            Thank you very much funklet, Your first code now works! I noted also Dim B As Image = New Bitmap ("image-path") works correctly.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups