Displaying same icon in 2 different sizes on c#
Posted
by ET
on Stack Overflow
See other posts from Stack Overflow
or by ET
Published on 2010-04-24T16:10:24Z
Indexed on
2010/04/24
16:13 UTC
Read the original article
Hit count: 187
My goal is to display the same icon twice, but each time in different size. I tried the following:
FileStream fs = new FileStream("name_of_the_icon_file.ico", FileMode.Open);
Icon ico = new Icon(fs, 32, 32); //create an in-memory instance of the icon, size 32x32
Icon ico2 = new Icon(fs, 16, 16); //create an in-memory instance of the icon, size 16x16
...
Graphics.DrawIcon(ico, /*some point*/);
Graphics.DrawIcon(ico2, /*some other point*/);
The last line throws an ArgumentException: Value does not fall within the expected range. Can some one explain me whats wrong and whats the way to do this right?
© Stack Overflow or respective owner