public PresenterServiceProvider() { _buttonLayoutManager = new NuGenSmoothButtonLayoutManager(); _buttonRenderer = new NuGenSmoothButtonRenderer(this); _checkBoxLayoutManager = new NuGenCheckBoxLayoutManager(); _checkBoxRenderer = new NuGenSmoothCheckBoxRenderer(this); _colorsProvider = new NuGenColorsProvider(); _comboBoxRenderer = new NuGenSmoothComboBoxRenderer(this); _controlImageManager = new NuGenControlImageManager(); _imageListService = new NuGenImageListService(); _directorySelectorRenderer = new NuGenSmoothDirectorySelectorRenderer(this); _dropDownRenderer = new NuGenSmoothDropDownRenderer(this); _fontFamiliesProvider = new NuGenFontFamiliesProvider(); _listBoxRenderer = new NuGenSmoothListBoxRenderer(this); _panelRenderer = new NuGenSmoothPanelRenderer(this); _progressBarLayoutManager = new NuGenProgressBarLayoutManager(); _progressBarRenderer = new NuGenSmoothProgressBarRenderer(this); _radioButtonLayoutManager = new NuGenRadioButtonLayoutManager(); _radioButtonRenderer = new NuGenSmoothRadioButtonRenderer(this); _scrollBarRenderer = new NuGenSmoothScrollBarRenderer(this); _spinRenderer = new NuGenSmoothSpinRenderer(this); _switchButtonLayoutManager = new NuGenSmoothSwitchButtonLayoutManager(); _switchButtonRenderer = new NuGenSmoothSwitchButtonRenderer(this); _tabStateService = new NuGenTabStateService(); _tabLayoutManager = new NuGenSmoothTabLayoutManager(); _tabRenderer = new NuGenSmoothTabRenderer(this); _tempImageService = new NuGenTempImageService(); _textBoxRenderer = new NuGenSmoothTextBoxRenderer(this); _trackBarRenderer = new NuGenSmoothTrackBarRenderer(this); _thumbnailLayoutManager = new NuGenSmoothThumbnailLayoutManager(); _thumbnailRenderer = new NuGenSmoothThumbnailRenderer(this); _toolStripRenderer = new NuGenSmoothToolStripRenderer(); _valueTrackerService = new NuGenValueTrackerService(); _smoothColorManager = new NuGenSmoothColorManager(); }
/// <summary> /// </summary> /// <param name="serviceProvider"> /// <para>Requires:</para> /// <para><see cref="INuGenSmoothColorManager"/></para> /// </param> /// <param name="paintParams"></param> /// <exception cref="ArgumentNullException"> /// <para><paramref name="serviceProvider"/> is <see langword="null"/>.</para> /// -or- /// <para><paramref name="paintParams"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="NuGenServiceNotFoundException"/> public static void DrawBackground(INuGenServiceProvider serviceProvider, NuGenPaintParams paintParams) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } if (paintParams == null) { throw new ArgumentNullException("paintParams"); } Graphics g = paintParams.Graphics; Rectangle bounds = paintParams.Bounds; NuGenControlState state = paintParams.State; RectangleF ellipseBounds = new RectangleF( bounds.Left - bounds.Width * 0.2f , bounds.Top + bounds.Height * 0.6f , bounds.Width * 2 , bounds.Height ); if (ellipseBounds.Width > 0 && ellipseBounds.Height > 0) { INuGenSmoothColorManager colorManager = serviceProvider.GetService <INuGenSmoothColorManager>(); if (colorManager == null) { throw new NuGenServiceNotFoundException <INuGenSmoothColorManager>(); } Color beginColor = Color.FromArgb(60, colorManager.GetBorderColor(state)); Color endColor = Color.FromArgb(10, colorManager.GetBackgroundGradientEnd(state)); using (Brush brush = new LinearGradientBrush(ellipseBounds, beginColor, endColor, 0.0f)) { g.SetClip(bounds, CombineMode.Replace); g.FillEllipse(brush, ellipseBounds); } } }