$theTitle=wp_title(" - ", false); if($theTitle != "") { ?>
dabbling, frivolling, idling, loafing, loitering, playing and procrastinating
22 Apr // php the_time('Y') ?>
This annoyed me somewhat as I couldn’t find any good documented examples of how to use resourced icons in a C# project. So, after a few google searches the answer is…
Properties.Resources.yourResourceNameHere
or
Form1.Properties.Resources.yourResourceNameHere
Yup, its that simple, of course though this can get more complex. In my project I wanted to put some icons into an ImageList, but I wanted to put all my embedded icons into it and then assign them keys so that other parts of my code could find them. (This could obviously be improved, especially where it checks to see what type of resource it is)
foreach (DictionaryEntry resourceEntry in Properties.Resources.ResourceManager.GetResourceSet(
System.Globalization.CultureInfo.CurrentUICulture, true, true));
{
if (resourceEntry.Value.GetType().ToString() == “System.Drawing.Icon”)
{
imageList.Images.Add((System.Drawing.Icon) Properties.Resources.ResourceManager.GetObject( resourceEntry.Key.ToString()));
imageList.Images.SetKeyName(imageList.Images.Count - 1, resourceEntry.Key.ToString());
}
}
It looks a bit messy here, but it looks much better in a proper editor ![]()
2 Responses for "Using Resource Icons in C#"
Thank you. I’ve just spent a couple of hours trying to find this. (My Google-Fu is weak today.)
Pro blog. I personally do not trust wordpress because a month ago, my blog disapeared….. Just to inform you all.
Leave a reply