/// <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(Resources.BitmapResources rBitmapSmall, Resources.BitmapResources rBitmap, string description, Resources.BitmapResources rLargeSizeBitmap) { // Get the images from the resource manager. _imageSmall = Resources.GetBitmap(rBitmapSmall); _image = Resources.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 = Resources.GetBitmap(rLargeSizeBitmap); _largeWidth = bmp.Width; _largeHeight = bmp.Height; }