Example #1
0
        public static Bitmap LoadElement(string resourceName, NativeElementState state)
        {
            try
            {
                string stateName;
                switch (state)
                {
                case NativeElementState.Normal: stateName = "Normal";
                    break;

                case NativeElementState.Focused: stateName = "Focused";
                    break;

                case NativeElementState.Pressed: stateName = "Pressed";
                    break;

                case NativeElementState.Disabled: stateName = "Disabled";
                    break;

                default:
                    stateName = "Normal";
                    break;
                }

                return(FastBitmap.FromNativeResource(resourceName + stateName + ".png"));
            }
            catch (Exception ex)
            {
                throw new ThemeException("Resource " + resourceName + " was not found", ex);
            }
        }
Example #2
0
 public static Image Load(string resourceName)
 {
     try
     {
         return(FastBitmap.FromNativeResource(resourceName));
     }
     catch (Exception ex)
     {
         throw new ThemeException("Resource " + resourceName + " was not found", ex);
     }
 }
Example #3
0
        public static Image Load(string resourceName, int width, int height)
        {
            Bitmap temp = null;

            try
            {
                temp = FastBitmap.FromNativeResource(resourceName);
            }
            catch
            {
                temp = null;
            }

            if (temp != null)
            {
                return(BitmapPainter.ResizeBitmap(temp, width, height, true));
            }
            else
            {
                return(null);
            }
        }