These Methods are used To Embed Images into Applications.......
///By Ramesh.R
private Bitmap EmbedImage(string imagePath)
{
try
{
return new Bitmap(typeof(Form1), imagePath);
}
catch (Exception ex)
{
throw ex;
}
}
public static Bitmap EmbedImage1(string imagePath)
{
try
{
Assembly assembly = Assembly.GetExecutingAssembly();
Stream stream;
stream = null;
Bitmap bmp = null;
stream = assembly.GetManifestResourceStream(imagePath);
stream.Position = 0;
bmp = (Bitmap)Bitmap.FromStream(stream);
return bmp;
}
catch (Exception ex)
{
throw ex;
}
}
Here..,
imagePath --> Path where the Image Placed..
Both Methods returns a Bitmap instance of the Image.
For this Method to work make sure the Images Property
No comments:
Post a Comment