Visual Studio Windows form image files

Posted on 2006-05-01
Last Modified: 2010-05-18

I am building a Windows form in visual studio 2005, which includes several small bitmap files that are loaded into a PictureBox in various scenarios.

What is the best way to load these images (and if necessary delete them) into the project,
so that the project does not have to reference any files outside of the project folders.

Is the correct approach to save the bitmap files into a new sub-folder of the main folder and then load them by clicking on the image property and and loading them into the project resource/local resource file.

In short I want to be able to cleanly load/unload bitmap files so that they are part of the project and not connected to anything outside of it.

Thank you in advance…..
Question by:murbro
    LVL 96

    Expert Comment

    by:Bob Learned
    1) Are these dynamic or static images?

    2) If they are static, then you can load the images into the PictureBox controls, and the images will be stored in binary format in the .resx file associated with the form.

    LVL 96

    Expert Comment

    by:Bob Learned
    BTW, I have come up with a working Excel border dialog, if you are interested in a working example.

    LVL 10

    Accepted Solution

    You can use the Resource Designer to add or edit resources for your project. Resource types supported by the Resource Designer include strings, images, icons, audio, and files.

    1. With a project selected in Solution Explorer, on the Project menu click Properties.

    2. Select the Resources tab.

    3. On the Resource Designer toolbar, point to Add Resource, click the arrow, then click Add Existing File.

    4. In the Add existing file to resources dialog box, browse to the file containing the resource that you wish to add (.bmp, .ico, .wav, etc,), and then click Open.

    5. Assume you add 2 image file and the name is Image1.bmp, Image2.bmp

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

            Me.PictureBox1.Image = My.Resources.Images1

        End Sub

        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

            Me.PictureBox1.Image = My.Resources.Images2

        End Sub

    Author Comment

    Hi Bob

    I am really interested in seeing a working example for an Excel border dialog



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Suggested Solutions

    Title # Comments Views Activity
    Help with MSXML and Visual Studio 2013 1 32
    VB.Net - o365 and Email 7 23
    prevent lose focus 6 48
    Parameter for stored procedure 6 40
    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now