Solved

Visual Studio 2005 (Tools for Office) Embed jpeg in Windows form

Posted on 2007-11-13
1
330 Views
Last Modified: 2013-11-26
Hi

Is there a way to embed a jpeg in a VS 2005 Windows form so that it is part of the project?

Thanks

Murray
0
Comment
Question by:murbro
1 Comment
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 20277987
You can certainly embed an image into a Project...and then access that image from a Form...not sure if that is what you are asking for?...

Click on Project --> Add Existing Item and add your image.
Now select your image in the "Solution Explorer" window.
Down below in the "Properties" window, change the "Build Action" property from "Content" to "Embedded Resource".

Then even use code like this to load the image at run-time:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        PictureBox1.Image = New Bitmap(Me.GetType, "yourImageName.jpg")
    End Sub

End Class

Of course, you replace "yourImageName.jpg" with whatever the name of your embedded image is.

*** Note that this is one of the rare occasions where VB.Net IS actually case-sensitive. ***
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

17 Experts available now in Live!

Get 1:1 Help Now