# BackgroundImae

**URL:** <https://tech-community.robotics.abb.com/t/backgroundimae/2474>\
**Category:** Developer Tools\
**Created:** [January 30, 2009, 6:29pm UTC](https://tech-community.robotics.abb.com/t/backgroundimae/2474 "2009-01-30T18:29:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![SlickRick](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@SlickRick](https://tech-community.robotics.abb.com/u/SlickRick)\
**Post date:** [January 30, 2009, 6:29pm UTC](https://tech-community.robotics.abb.com/t/backgroundimae/2474/1 "2009-01-30T18:29:17Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![RussD](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@RussD](https://tech-community.robotics.abb.com/u/RussD)\
**Post date:** [January 30, 2009, 6:41pm UTC](https://tech-community.robotics.abb.com/t/backgroundimae/2474/2 "2009-01-30T18:41:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![SlickRick](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@SlickRick](https://tech-community.robotics.abb.com/u/SlickRick)\
**Post date:** [January 30, 2009, 8:20pm UTC](https://tech-community.robotics.abb.com/t/backgroundimae/2474/3 "2009-01-30T20:20:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![carlosmtz2000](https://avatars.discourse-cdn.com/v4/letter/c/e79b87/32.png) [@carlosmtz2000](https://tech-community.robotics.abb.com/u/carlosmtz2000)\
**Post date:** [January 30, 2009, 8:34pm UTC](https://tech-community.robotics.abb.com/t/backgroundimae/2474/4 "2009-01-30T20:34:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RussD](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@RussD](https://tech-community.robotics.abb.com/u/RussD)\
**Post date:** [January 30, 2009, 8:45pm UTC](https://tech-community.robotics.abb.com/t/backgroundimae/2474/5 "2009-01-30T20:45:54Z")

</div>

Maybe also try copying the image file to the HOME dir of the system.

---

<div class="post-metadata">

**Author:** ![SlickRick](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@SlickRick](https://tech-community.robotics.abb.com/u/SlickRick)\
**Post date:** [January 30, 2009, 9:50pm UTC](https://tech-community.robotics.abb.com/t/backgroundimae/2474/6 "2009-01-30T21:50:12Z")

</div>

Hello Carlos,  
I’m new to C# so I’m not fully understanding your questions. Could you please be more specific?

Thank You,  
Rick

---

<div class="post-metadata">

**Author:** ![carlosmtz2000](https://avatars.discourse-cdn.com/v4/letter/c/e79b87/32.png) [@carlosmtz2000](https://tech-community.robotics.abb.com/u/carlosmtz2000)\
**Post date:** [January 30, 2009, 10:21pm UTC](https://tech-community.robotics.abb.com/t/backgroundimae/2474/7 "2009-01-30T22:21:32Z")

</div>

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 !!!

---

<div class="post-metadata">

**Author:** ![SlickRick](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@SlickRick](https://tech-community.robotics.abb.com/u/SlickRick)\
**Post date:** [January 30, 2009, 11:00pm UTC](https://tech-community.robotics.abb.com/t/backgroundimae/2474/8 "2009-01-30T23:00:22Z")

</div>

Hello Carlos,  
Once the ABB.Robotics.TAF.Base reference was added option A worked.

Thank you very much for your help,  
Rick

---

<div class="post-metadata">

**Author:** ![carlosmtz2000](https://avatars.discourse-cdn.com/v4/letter/c/e79b87/32.png) [@carlosmtz2000](https://tech-community.robotics.abb.com/u/carlosmtz2000)\
**Post date:** [January 30, 2009, 11:38pm UTC](https://tech-community.robotics.abb.com/t/backgroundimae/2474/9 "2009-01-30T23:38:47Z")

</div>

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
