Images in FP application
Hello,
I'm trying to get some images into my TPSview application, but I can't get it to work. Can anyone help me?
If I follow the Visual Studio way,
Dim myImage As System.Drawing.Image = Image.FromFile("Image.bmp")
I get the error: fromfile not a member of system.drawing.image
In the FP SDK manuals, I can't find a way to add images to my button.
Jan-Jaap
Comments
-
Hi
Here is an example how to do it in C# should be easy to convert that
into VB.private ABB.Robotics.Tps.Resources.TpsResourceManager res=
new ABB.Robotics.Tps.Resources.TpsResourceManager();System.Windows.Forms.PictureBox target=new System.Windows.Forms.PictureBox();
target.Image=res.GetImage("myImage.bmp");
Per Svensson
Company Specialist
ABB Automation Technology Products0 -
Jan-Jaap,
if you include the bitmap as an embedded resource in the assembly by adding it in the project and then set the Build Action property for the file to "Embedded Resource" you can use the following code to get the image:
myImage.Image = New Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("TpsViewXXXXXX.Image.bmp"))Observe that the complete namespace is necessary to get the resource.
Regards,
Urban Vikblom
CONTAB0 -
Hello,
Is the embedded resource option to prefer due to performance?
I get an error on "assembly" , even though I have:
Imports System.ReflectionSomething else I'm missing?
jan-jaap38761,4772685185Regards,
Jan-Jaap0 -
No, I have't checked if the performance improves. It just makes it simpler to handle the image file. Otherwise you must make sure that the file is available and where it is. If you move the assembly the image follows the assembly if it is embedded. It is also a way of making sure that the customer doesn't change the image. Also if you do a localized application the image could be placed in a sattelite assembly and loaded in a similar way.
What is the error and how does your source code look like? References OK?
Urban Vikblom
CONTAB0 -
I added system.refelction before assembly, and now it works OK.
Thanks for the info.
Regards,
Jan-Jaap0
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 309 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings