where to put bitmaps in a GetImage comman


Hello all,

I have create a PictureBox with an image. I want to change the image during run time. I have found an instruction GetImage("xxx.bmp"). My question is "Where do i have to put my xxx.bmp on my pc, on the virtual controller and on the real controller?" If i run the application on the virtual controller i get this fault "System.NullReferenceException".

Can somebody help me?


  • Urban

    I recommend to put the image in the HOME directory or a sub-directory in HOME. Then use the FileSystem.RemoteDirectory and copy ( FileSystem.GetFile(remoteFile, localFile) ) to the local directory using FileSystem.LocalDirectory property.

    3 remarks here.

    1. Use "/" to separate directories.

    2. Create subdirectories explicitly for local storage.

    3. Default values: VIRC5 RemoteDirectory is "system"/HOME, VIRC5 LocalDirectory is "system"/INTERNAL, Controller RemoteDirectory is HOME and LocalDirectory is /Temp. (For debugging purpose good to know)

    To get better performace on controller, do not use PictureBox. Instead do your own Paint overriding OnPaintBackground, etc. 


    Urban Vikblom
  • Lennart H


    Please expand your answer regarding performing issues on the RC, maybe post a code example.


    Lennart H
  • Urban


    I had problems with PictureBox because of my inability to predict where and when to repaint after painting added information in the image. So I placed the calls a bit everywhere. This and added complexity of handling controller events (5.05) made performance a problem for me. Sorry, but I can't prove that PictureBox was the major problem (my collegue says SBK!).

    What I do know is that when I do not use PictureBox I can predict and test when the paint events are done and that I don't draw the images, added information and texts when it is not necessary.

    I should have remarked in the post above that if the functionality is good enough, PictureBox is OK. On the RC a certain lag is to be expected.


    Urban Vikblom
  • reschmann

    Hello Huyle<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />


    You can also emped your image direct in the dll of the assembly.

    Import the image in your project in VS and set it as an "Embedded Resource".

    Now, it is possible to load the specified manifest resource from this assembly.

    Use the ,Assembly.GetManifestResourceStream" Method:

    For example

    //strAsm is the name of your assembly as string

    private Bitmap imgMyImage;

    runAsm = System.Reflection.Assembly.GetExecutingAssembl();

    imgMyImage = new Bitmap(runAsm.GetManifestResourceStream(strAsm + ". imgMyImage.bmp"));