RobotStudio event

BackgroundImae

I am having issues trying to get a background image and imagebox to work on the virtual teachpendant.  I'm using C# 2005 and RW5.10.2.  Below is the code for the imagebox:
 

//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(289, 35);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(137, 57);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
 


The VTP will not run the application at all.  The error is FlexPendant Start View Problem.  Any help is greatly appreciated.

 

Thank You,
Rick Lemberg

Comments

  • Is this code written by you or by the designer? You can put this code inside a try/catch block to see the exception,  or just attach the debugger and step through the code as descibed in the help to see where you code is breaking. Are you using the same version of RAB as RW? You need to make sure both are of the same major version.

    RussD2009-01-30 19:31:07
    Russell Drown
  • RAB and RW match, they are both 5.10.  I ran the debugger and is stops on this line:
    this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));

    Also it is the designer that generated that code.  Your help appreciated.
     
    Thanks,
    Rick
    Rick Lemberg
  • Hi Rick,
     

    This might be either basic or advanced questions:

     

    - Could you identify the data type of the instance "resources"?

    - Could you make it a TpsResourceManager class?

     

    We could later check if the images is actually built or not inside your assembly file

     

    BR/Carlos

     
    Carlos Martinez
    ABB
  • Maybe also try copying the image file to the HOME dir of the system.
    Russell Drown
  • Hello Carlos,
      I'm new to C# so I'm not fully understanding your questions.  Could you please be more specific?

     

    Thank You,

    Rick
    Rick Lemberg
  • Hi Rick,
     

    Nto a problem. 

     

    In the source code that you are providing:

     

    this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));

     

    you can see that there is a local variable called resources. In order to check the data declaration of this variable,  you can right-click and select "Go To Definition". Here you will see the data type:

     

    System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(YOUR_TPS_VIEW_NAME));


     

    Change the declaration of this variable to be TpsResourceManager and try again. Sample Code:

     

    ABB.Robotics.Tps.Resources.TpsResourceManager resources = new ABB.Robotics.Tps.Resources.TpsResourceManager();

     

    Try to load your application. In case this does not work, we have two options:

     

    Option A) Instead of "compressing" the image file inside your application, we could have it outside in a jpg of bmp file (Russ proposal). In order to do this, leave the new declaration of the local variable resources, copy the image file inside the home folder and change the way the image is loaded inside the picture box:

     

    this.pictureBox1.Image = resources.GetImage("YourImage.jpg");

     

    Option B). We still include your images in your application DLL. IN order to do this, we just need to load the image inside the Visual Studio in a different way.

     

    This is not as complicated as it sounds. We should just go step by step :).

     

    Please let me know the process !!!
    Carlos Martinez
    ABB
  • Hello Carlos,
      Once the ABB.Robotics.TAF.Base reference was added option A worked. 

     

    Thank you very much for your help,

    Rick
    Rick Lemberg
  • Hi Rick,
     

    This is good to hear. Just remember that Option A requires that images files are always copied to all the systems you are installing this application.

     

    BR/Carlos
    Carlos Martinez
    ABB