Ejemplo n.º 1
0
        public static Cursor LoadResource(string resourceName)
        {
            Cursor arrow;

            try
            {
                using (Stream stream = PdnResources.CreateResourceStream(resourceName))
                {
                    arrow = new Cursor(stream, resourceName);
                }
            }
            catch (OutOfMemoryException)
            {
                arrow = Cursors.Arrow;
            }
            return(arrow);
        }
Ejemplo n.º 2
0
 public void LoadIcons()
 {
     foreach (FieldInfo info in base.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly))
     {
         if (info.FieldType.IsSubclassOf(typeof(PdnMenuItem)) || (info.FieldType == typeof(PdnMenuItem)))
         {
             char        ch       = info.Name[0];
             string      fileName = "Icons." + ch.ToString().ToUpper() + info.Name.Substring(1) + "Icon.png";
             PdnMenuItem item     = (PdnMenuItem)info.GetValue(this);
             Stream      stream   = PdnResources.CreateResourceStream(fileName);
             if (stream != null)
             {
                 stream.Dispose();
                 item.SetIcon(fileName);
             }
         }
     }
     this.iconsLoaded = true;
 }