I made the first form, and it has the background and a couple of small images placed on the form. Made the second form and so on. Am having a couple of forms by now, just the GUI so far.
Now this questions arises from a bad experience I had in Java. I saved all of my images in a folder somewhere at PC and referenced the images from there. Later, I deleted that image folder and thought the images would still be okay in the project. But it was all empty in the project.
In VS.NET here, how should I use images? Where should I place them? Inside the project? And should I use resources to manage the images or how exactly? Some explanation would be really helpful as am just starting off.
So that I am sure where ever I move the project and whatever I do, i won't lose the images inside the project.
For now I've made a folder namely images, inside the project and directly referencing it.
Thank you.
Need Advice - Using images with C# WinForms VS.NET Project
Re: Need Advice - Using images with C# WinForms VS.NET Project
Easy way to do this is to add a PictureBox and load the image from property Image.
After loading it to PictureBox you don't need to keep the file on disk (It is stored to application).
And you may make this PictureBox invisible and use the loaded image anywhere in the project.
There are so much of other ways to do the same thing. Just chose the easiest for you.
After loading it to PictureBox you don't need to keep the file on disk (It is stored to application).
And you may make this PictureBox invisible and use the loaded image anywhere in the project.
There are so much of other ways to do the same thing. Just chose the easiest for you.
Re: Need Advice - Using images with C# WinForms VS.NET Project
Sounds nice. I've already been using pictureBox for small pictures needed on the form which are clickable.
Can I use pictureBox for loading an image, disabling the pictureBox and using the same picture as Background of the form?
Or what other way of using background image is the easiest?
Can I use pictureBox for loading an image, disabling the pictureBox and using the same picture as Background of the form?
Or what other way of using background image is the easiest?
Re: Need Advice - Using images with C# WinForms VS.NET Project
Simple as follows.
However my point is, when you load an image to BackgroundImage property of Form using the property window, even you delete the image from disk it persist with the From. However you will have to exit from VS.net to delete the image from disk.
Code: Select all
Form1.ActiveForm.BackgroundImage = pictureBox1.Image;