Problems creating AlphaImage

Feb 2, 2010 at 5:49 PM


great work, but i have some problems adding a Image to an Alpha-PictureBox.

Your Test-App works fine, but if i create a AlphaPictureBox in my own project, and try to add an image to it, it gives different errors.

1.Try: AlphaImage.CreateFromFile(""); says allways: invalid path, i tried the path by creating normal bitmap, it works fine, but not with your Method.

Even if i copy and paste the path from your Test-App it says invalid path.......


2.Try: AlphaImage.CreateFromResources(""): gives an NullPointerException, the stream is null. But it exists, i have tested with several Resource objects, which work fine in the rest of the project.

I tried in DesignerCode and in own methodes by click, with same results.


Is this a known problem? I have seen on page 2 of the discussion somebody had the same problem, but their was no real solution...

Anyone got a solution to this?

Feb 3, 2010 at 6:16 AM

Hello again;)

If anybody stucks with the same problem, i got a solution.

The image, which you want to place in the AlphaPictureBox must be in the Resources folder of the project, and in the properties tab of the image, you must select: "Copy if newer" or "Copy always".

Then, you have to set the path to the image like it is down in the Test-App:

            string path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
            alphaPictureBox.Image = AlphaMobileControls.AlphaImage.CreateFromFile(path + @"\Resources\YourImage.jpg");

Any other directorie(or code variation) is not working for me, don´t know why.

I´m not sure, how this to lines manage to bring my image to the picturebox, i debugged it, and the path-string points to a totally wrong directorie, the directorie doesn´t even exist.

But it works.........