by Amr Elsehemy
15. March 2008 05:11
In my tour in exploring GDI+ I explored the Brush object, now its time for some Pen stuff.
While the Brush classes are used to fill shapes, the Pen class is used to frame shapes. However, Pens are not only used for simple frames. Here in this post I show some advanced uses for the Pen. More...
by Amr Elsehemy
21. February 2008 15:25
Update: This approach is only to show one of the hidden gems in the .net framework and not to steal copyrighted icons.
Icons of other programs should only be used after owner approval.
Have you ever seen a file with a pretty icon you wanted to use but you couldn't get a similar one in your program?
If yes, try this method >> Icon.ExtractAssociatedIcon here is the code I wrote that works fine, you will also find the sample attached
Icon ico;
public Form1()
{
InitializeComponent();
ico = this.Icon;
}
private void btnGetIcon_Click(object sender, EventArgs e)
{
if(dlgOpen.ShowDialog() == DialogResult.OK)
{
ico = Icon.ExtractAssociatedIcon(dlgOpen.FileName);
this.Icon = ico;
pnlIcon.Invalidate();
}
}
private void pnlIcon_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawIcon(ico, pnlIcon.ClientRectangle);
}
IconExtractor.zip (7.03 kb)