/// <summary> /// Gets the content image. /// </summary> /// <param name="state">The state for which the image is needed.</param> /// <returns>Image value.</returns> public virtual Image GetImage(PaletteState state) { // Find the correct collection of images GalleryButtonImages images = null; switch (_button) { case PaletteRibbonGalleryButton.Up: images = _images.Up; break; case PaletteRibbonGalleryButton.Down: images = _images.Down; break; case PaletteRibbonGalleryButton.DropDown: images = _images.DropDown; break; } // Get image based on state Image image = null; switch (State) { case PaletteState.Disabled: image = images.Disabled; break; case PaletteState.Normal: image = images.Normal; break; case PaletteState.Tracking: image = images.Tracking; break; case PaletteState.Pressed: image = images.Pressed; break; } // If no image then get the common image if (image == null) { image = images.Common; } // If still no image then get is from the palette if (image == null) { return(_palette.GetGalleryButtonImage(_button, State)); } else { return(image); } }
/// <summary> /// Initialize a new instance of the GalleryImages class. /// </summary> /// <param name="needPaint">Delegate for notifying paint requests.</param> public GalleryImages(NeedPaintHandler needPaint) { // Store the provided paint notification delegate NeedPaint = needPaint; // Create the storage Up = new GalleryButtonImages(needPaint); Down = new GalleryButtonImages(needPaint); DropDown = new GalleryButtonImages(needPaint); }