Hi to all.
I was working on an application in windows forms using C# in Microsoft visual studio.
I'm not new to windows programming but i am new in using the picture box.
My question may seem very dumb but i please if you can help me out.
My application is simple: It simply accepts 3 integer values and it determines if these values can sides of a triangle or not, plus it also deduces (if it is a triangle) the type i.e. equilateral, isosceles, scalene triangle.
When the user enters the three integers, the user must press a button "Get Results" and after pressing this button, i made a picture box showing the type of triangle.
I used this code:
pb1.Image = new Bitmap("C:\\scab.bmp");
But the problem is that if i remove the images from that location, it gives a run-time error! So what code should i use so that these images can be saved in the applet and if i use it on another PC it wont crush.
I know that these types of applications my have to include a "resources" folder with them but if possible how can i do so that this applet is a a single file and can be executed anywhere without having to carry the images around every time.
Thanks for you support... Hope i have a suitable answer ASAP!.
Best Regards & Happy Holidays to everyone
Manuel Portelli
Loading
Roy SPosted Dec 26, 2011, 5:36 PM
Now you can access that bitmap by using:
pb1.Image = YourNamespace.Properties.Resources.BitmapName;
(replace the bolded parts with the appropriate substitute)
More info about this can be found here:
http://msdn.microsoft.com/en-us/library/7k989cfy%28v=vs.80%29.aspx
Sam HobbsPosted Dec 27, 2011, 4:47 PM
Manuel PortelliPosted Dec 27, 2011, 8:50 AM
Seems that Roy S gave me the correct answer i was looking for.
Regards and thanks for your help!
Manuel Portelli
Sam HobbsPosted Dec 26, 2011, 7:12 PM
I am sorry, but your question is confusing. Roy explained how you can load a bitmap into the PictureBox. You seem to need to do more but it is not clear what more. I think you are saying that you need to draw in the bitmap; such as draw a triangle. You also say you need to save the bitmap. Is that correct? I do not however understand "remove the images from that location". So if you need more help and if you can provide some clarification then we can help you better.