/// <summary> /// This constructor gets all the pieces at once. /// </summary> /// <param name="rBitmapSmall"></param> /// <param name="rBitmap"></param> /// <param name="description"></param> /// <param name="rLargeSizeBitmap"></param> public MenuItem(Resource.BitmapResources rBitmapSmall, Resource.BitmapResources rBitmap, string description, Resource.BitmapResources rLargeSizeBitmap) { // Get the images from the resource manager. _imageSmall = Resource.GetBitmap(rBitmapSmall); _image = Resource.GetBitmap(rBitmap); // Set the description. _description = description; // Create the step arrays for zooming in and out. _widthSteps = new int[MenuItemPanel.maxStep]; _heightSteps = new int[MenuItemPanel.maxStep]; // Get the difference in size between the large and small images. int wDiff = _image.Width - _imageSmall.Width; int hDiff = _image.Height - _imageSmall.Height; // Pre-calculate the width and height values for scaling the image. for (int i = 1; i < MenuItemPanel.maxStep; i++) { _widthSteps[i] = (wDiff / MenuItemPanel.maxStep) * i; _heightSteps[i] = (hDiff / MenuItemPanel.maxStep) * i; } // Set the large width and height based on one of the main icons. Bitmap bmp = Resource.GetBitmap(rLargeSizeBitmap); _largeWidth = bmp.Width; _largeHeight = bmp.Height; }
internal static System.Drawing.Bitmap GetBitmap(Resource.BitmapResources id) { return((System.Drawing.Bitmap)(ResourceManager.GetObject(((short)(id))))); }
internal static nanoFramework.UI.Bitmap GetBitmap(Resource.BitmapResources id) { return((nanoFramework.UI.Bitmap)(nanoFramework.Runtime.Native.ResourceUtility.GetObject(ResourceManager, id))); }