TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Converting an .Ico File to a .Bmp in C#
Carmelo La Monica
Apr 25
2015
Code
5.2
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
C# Convert an .Ico F
using
System.Drawing;
using
System.Windows.Forms;
namespace
WindowsFormsApplication1
{
public
partial
class
Form1 : Form
{
public
Bitmap FromIconToBitmap(Icon icon)
{
Bitmap bmp =
new
Bitmap(icon.Width, icon.Height);
using
(Graphics gp = Graphics.FromImage(bmp))
{
gp.Clear(Color.Transparent);
gp.DrawIcon(icon,
new
Rectangle(0, 0, icon.Width, icon.Height));
}
return
bmp;
}
private
void
Button1_Click(System.Object sender, System.EventArgs e)
{
Icon icon = WindowsFormsApplication1.Properties.Resources.Icon1;
pictureBox1.Image = FromIconToBitmap(icon);
}
}
}
C#
Converting image