Bitmaps (5.08)
Hi,
As beeing new to this I seem to have gotten a bit stuck. I'm trying to use a standard picture box control and just assign an image to it. When I do this for a standard pc .net application, it's no problem. But when I try to do it for a the flexpendant, I can't get it to work.
I guess I don't understand how to assign (or embedd) the bitmap file into the project.
There is very little written about this in the documentation (Page 99). It would be good to have some kind of guide describing this. That could then be used for all bitmap operations, like for buttons and so on.
There is another thread talking about images. That one suggests to remove the "StartupType = TpsViewStartupTypes.Manual". But when I do that in my project I get an error saying: Overload Resolution failed because no accessible 'new' accepts this number of arguments.
Does any one have some guides. Or does anyone have some small example project with a picturebox
/Per
Comments
-
Hi Per
It was a while since I wrote a RAB application but back then I used the Resource Manager (TpsResourceManager it was called back then) and then used the method GetImage("myImage.jpg")Per Svensson
Robotics and Vision Specialist
Consat Engineering0 -
Hi PerM,
The sollution of removing StartupType etc. is valid but is for a bug in the virtual FP not the real one. What you could try is to select your program -> properties -> resources -> add new file : and then select the images you wan't to use. This way they get embedded in to your program and you "shouldn't" have anny more problems. If you want to use the pics on a contorl like tabControl you should add a ImageList to your design in wich you declare the pictures.
P.S. What kind of documenation are you using cause in my "FlexPendant SDK Reference Documentation.chm" there are no pagenumbers that I see? I'm asking cause I was using the old User Guide.pdf before wich was for 5.07 and did not coffer the graffic toolbox options of 5.09.
Hope this helps you out a bit.
0 -
Hi again,
I'm referring to the Application Manual for 5.08 /(3HAC028083-001)
And I also need to mention that I am experementing with this on the Virtual FP so the bug with the startup type should be a problem also for me. Should I remove it even though I get the error, or should I change the value on it from Manual to Automatic?
Now I've added the image as a resource. I just pointed to the file I need. That worked.
But how do i get my picture box to use that resource. If I edit the pictureBox1.image i get a file browser. I can't reference my resourse.
There must be somehow that I connect the picture box with the resource name.
/Per M
0 -
Hi
Something like this
this.myPictureBox.Image = myResource.GetImage("myImage");Per Svensson
Robotics and Vision Specialist
Consat Engineering0 -
This is strange,
I must be doing something backwards. I can't seem to get this to work. Now I have the resource added. It's called Bullseye.gif and was automatically placed in the resources directory.
When I set the image property of the picturebox to the BullsEye.gif file in the resource directory, there is automatically added one line to the "InitializeComponents" procedure:
Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)But when I run this it hangs crashes when starting up.
I have also tried to access the "resources.GetObject" further down in the code. But then there is no refernces from "resorces" to "GetObject".
What might I be doing wrong.
/Per M
0 -
Hi again,
If you are going to use the virtual FP then yes I would leave the last option away. I don't know what's going wrong in your code tho. You say it hangs right after start up? Then there has to be a problem while initialising the components I think. Try removing things to where your code does work and then go from there.
You are talking about the resource directory, I assume you mean the resource object/item in the menu next to your visual lay-out? (design view) I'm beginning to think you type all the code instead of just dragging and dropping components in your design view. (You do have to use the RAB components to do that, except for things like ImageList that are non visual, then use the standard components) correct me if I'm wrong?
Another thing, and I'm absolutely not sure about this, but shouldn't it say: Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.gif"), System.Drawing.Image) Does annyone know? I'd have to look that up when I get back to work tomorow.
Hope I helpt you out here a bit,
Qrius
Hope this helps
0 -
In VB, if you have added an embedded resource, you should just be able to do somtething like:
PictureBox1.Image = My.Resources.pilotOff
where using the My keyword will access the built in resource file for your project, and pilotOff is the name of an embedded image resource
Russell Drown0 -
Well, now I've tried a little bit different approach to this. I've made a small little application with one picture box and one abb button.
The gif file is added as a resource.
The picture box is empty when starting. I then load the image with the button, using below code:
PictureBox1.Image = My.Resources.P51The application starts, but directly when pressing the button it crashes with the error: "Binary format of the specified custom attribute was invalid."
This sounds like somekind of file problem.
This is a bit different error than before. Then there was a FlexPendant error.
I have included the project below
0 -
I think you are seeing the problem with the attribute that was mentioned earlier. If you change the assembly attributes to:
<Assembly: ABB.Robotics.Tps.Taf.TpsView("Image Test", "tpu-Operator32.gif", "tpu-Operator16.gif", "TpsViewImageTest.dll", _ "TpsViewImageTest.TpsViewImageTest", StartPanelLocation.Left, TpsViewType.Static)>it should work on the VC.
Russell Drown0 -
Well, now finally with that last tip from RussD, it works.
It seams that I can't use a default image in a picture box. I now leave it empty in design time, and put the image in to it at run time in the "Activate" event.
That in combination with removing the "Startuptype" seams to have fixed.
I'll be back with more questions.
Thanks all you...
/PerM
0 -
Well actually I think it's just the Virtual FP bug/problem not a picture problem. The application works fine on real FP right? Well then just change teh assembly like Russ said and it should work on Virtual FP just as well.
The virtual FP seems to have a problem using the startuptype manual. Damn pc's allways wanna control everything them selfs... NO manual thingies here!
0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 314 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 794 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings