/* * OnUnsubscribeControlEvents */ /// <summary> /// Unsubscribes events from the hosted control. /// </summary> /// <param name="control">The control from which to unsubscribe events.</param> protected override void OnUnsubscribeControlEvents(Control control) { base.OnUnsubscribeControlEvents(control); NuGenTrackBar trackBar = (NuGenTrackBar)control; trackBar.LargeChangeChanged -= _trackBar_LargeChangeChanged; trackBar.MaximumChanged -= _trackBar_MaximumChanged; trackBar.MinimumChanged -= _trackBar_MinimumChanged; trackBar.SmallChangeChanged -= _trackBar_SmallChangeChanged; trackBar.TickStyleChanged -= _trackBar_TickStyleChanged; trackBar.ValueChanged -= _trackBar_ValueChanged; }
private static Control CreateControlInstance(INuGenServiceProvider serviceProvider) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } NuGenTrackBar trackBar = new NuGenTrackBar(serviceProvider); trackBar.Size = new Size(100, 30); trackBar.MinimumSize = new Size(30, 30); return(trackBar); }
/// <summary> /// Initializes a new instance of the <see cref="ToolBar"/> class. /// </summary> /// <param name="serviceProvider"><para>Requires:</para> /// <para><see cref="INuGenButtonStateService"/></para> /// <para><see cref="INuGenControlStateService"/></para> /// <para><see cref="INuGenPanelRenderer"/></para> /// <para><see cref="INuGenSwitchButtonLayoutManager"/></para> /// <para><see cref="INuGenSwitchButtonRenderer"/></para> /// <para><see cref="INuGenTrackBarRenderer"/></para> /// <para><see cref="INuGenValueTrackerService"/></para> /// <para><see cref="INuGenThumbnailLayoutManager"/></para> /// <para><see cref="INuGenThumbnailRenderer"/></para> /// </param> /// <exception cref="ArgumentNullException"><paramref name="serviceProvider"/> is <see langword="null"/>.</exception> /// <exception cref="NuGenServiceNotFoundException"/> public ToolBar(INuGenServiceProvider serviceProvider) : base(serviceProvider) { this.Dock = DockStyle.Bottom; this.Padding = new Padding(1, 2, 1, 2); _trackBar = new NuGenTrackBar(serviceProvider); _trackBar.Dock = DockStyle.Left; _trackBar.Minimum = 100; _trackBar.Maximum = 500; _trackBar.LargeChange = 100; _trackBar.SmallChange = 25; _trackBar.TickStyle = TickStyle.TopLeft; _trackBar.Width = 100; _trackBar.ValueChanged += _trackBar_ValueChanged; _rotateCWButton = new ToolBarButton(serviceProvider); _rotateCWButton.Click += _rotateCWButton_Click; _rotateCWButton.Image = this.ThumbnailRenderer.GetRotateCWImage(); _rotateCWButton.Visible = false; _rotateCCWButton = new ToolBarButton(serviceProvider); _rotateCCWButton.Click += _rotateCCWButton_Click; _rotateCCWButton.Image = this.ThumbnailRenderer.GetRotateCCWImage(); _rotateCCWButton.Visible = false; _separators = new ToolBarSeparatorButton[2]; for (int i = 0; i < _separators.Length; i++) { _separators[i] = new ToolBarSeparatorButton(serviceProvider); } _separators[0].Visible = false; _loupeModeButton = new ToolBarButton(serviceProvider); _loupeModeButton.Click += _loupeModeButton_Click; _loupeModeButton.Image = this.ThumbnailRenderer.GetLoupeModeImage(); _gridModeButton = new ToolBarButton(serviceProvider); _gridModeButton.Checked = true; _gridModeButton.Click += _gridModeButton_Click; _gridModeButton.Image = this.ThumbnailRenderer.GetGridModeImage(); _zoomInButton = new ToolBarButton(serviceProvider); _zoomInButton.Click += _zoomInButton_Click; _zoomInButton.Image = this.ThumbnailRenderer.GetZoomInImage(); _zoomInButton.Visible = false; _zoomOutButton = new ToolBarButton(serviceProvider); _zoomOutButton.Click += _zoomOutButton_Click; _zoomOutButton.Image = this.ThumbnailRenderer.GetZoomOutImage(); _zoomOutButton.Visible = false; this.Controls.AddRange( new Control[] { _trackBar , _zoomInButton , _zoomOutButton , _separators[0] , _rotateCWButton , _rotateCCWButton , _separators[1] , _loupeModeButton , _gridModeButton } ); }
private static Control CreateControlInstance(INuGenServiceProvider serviceProvider) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } NuGenTrackBar trackBar = new NuGenTrackBar(serviceProvider); trackBar.Size = new Size(100, 30); trackBar.MinimumSize = new Size(30, 30); return trackBar; }