Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NuGenThumbnailContainer"/> 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="INuGenScrollBarRenderer"/></para>
        /// <para><see cref="INuGenSwitchButtonLayoutManager"/></para>
        /// <para><see cref="INuGenSwitchButtonRenderer"/></para>
        /// <para><see cref="INuGenTrackBarRenderer"/></para>
        /// <para><see cref="INuGenThumbnailLayoutManager"/></para>
        /// <para><see cref="INuGenThumbnailRenderer"/></para>
        /// <para><see cref="INuGenToolStripRenderer"/></para>
        /// <para><see cref="INuGenValueTrackerService"/></para>
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="serviceProvider"/> is <see langword="null"/>.</para>
        /// </exception>
        public NuGenThumbnailContainer(INuGenServiceProvider serviceProvider)
            : base(serviceProvider)
        {
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.Opaque, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.Selectable, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, false);
            this.SetStyle(ControlStyles.UserPaint, true);

            _scrollBar               = new NuGenScrollBar(serviceProvider);
            _scrollBar.Orientation   = NuGenOrientationStyle.Vertical;
            _scrollBar.Dock          = DockStyle.Right;
            _scrollBar.Maximum       = 0;
            _scrollBar.Value         = 0;
            _scrollBar.Visible       = true;
            _scrollBar.ValueChanged += _scrollBar_ValueChanged;
            _scrollBar.Parent        = this;

            _toolBar                         = new ToolBar(serviceProvider);
            _toolBar.Height                  = this.LayoutManager.GetToolbarHeight();
            _toolBar.ModeChanged            += _layoutPanel_ModeChanged;
            _toolBar.Rotate90CWButtonClick  += _toolBar_Rotate90CWButtonClick;
            _toolBar.Rotate90CCWButtonClick += _toolBar_Rotate90CCWButtonClick;
            _toolBar.ZoomInButtonClick      += _toolBar_ZoomInButtonClick;
            _toolBar.ZoomOutButtonClick     += _toolBar_ZoomOutButtonClick;
            _toolBar.ThumbnailSizeChanged   += _toolBar_ThumbnailSizeChanged;
            _toolBar.Parent                  = this;

            _imageTracker = new ImageTracker();

            _gridPanel                       = new GridPanel(serviceProvider, _imageTracker);
            _gridPanel.Layout               += _gridPanel_Layout;
            _gridPanel.ModeChanged          += _layoutPanel_ModeChanged;
            _gridPanel.RightToLeftChanged   += _gridPanel_RightToLeftChanged;
            _gridPanel.ThumbnailSizeChanged += _gridPanel_ThumbnailSizeChanged;
            _gridPanel.Visible               = false;
            _gridPanel.Parent                = this;

            _loupePanel              = new LoupePanel(serviceProvider, _imageTracker);
            _loupePanel.ModeChanged += _layoutPanel_ModeChanged;
            _loupePanel.Visible      = false;
            _loupePanel.Parent       = this;

            this.RebuildLayout();
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenThumbnailContainer"/> 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="INuGenScrollBarRenderer"/></para>
		/// <para><see cref="INuGenSwitchButtonLayoutManager"/></para>
		/// <para><see cref="INuGenSwitchButtonRenderer"/></para>
		/// <para><see cref="INuGenTrackBarRenderer"/></para>
		/// <para><see cref="INuGenThumbnailLayoutManager"/></para>
		/// <para><see cref="INuGenThumbnailRenderer"/></para>
		/// <para><see cref="INuGenToolStripRenderer"/></para>
		/// <para><see cref="INuGenValueTrackerService"/></para>
		/// </param>
		/// <exception cref="ArgumentNullException">
		/// <para><paramref name="serviceProvider"/> is <see langword="null"/>.</para>
		/// </exception>
		public NuGenThumbnailContainer(INuGenServiceProvider serviceProvider)
			: base(serviceProvider)
		{
			this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			this.SetStyle(ControlStyles.Opaque, true);
			this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
			this.SetStyle(ControlStyles.ResizeRedraw, true);
			this.SetStyle(ControlStyles.Selectable, true);
			this.SetStyle(ControlStyles.SupportsTransparentBackColor, false);
			this.SetStyle(ControlStyles.UserPaint, true);

			_scrollBar = new NuGenScrollBar(serviceProvider);
			_scrollBar.Orientation = NuGenOrientationStyle.Vertical;
			_scrollBar.Dock = DockStyle.Right;
			_scrollBar.Maximum = 0;
			_scrollBar.Value = 0;
			_scrollBar.Visible = true;
			_scrollBar.ValueChanged += _scrollBar_ValueChanged;
			_scrollBar.Parent = this;

			_toolBar = new ToolBar(serviceProvider);
			_toolBar.Height = this.LayoutManager.GetToolbarHeight();
			_toolBar.ModeChanged += _layoutPanel_ModeChanged;
			_toolBar.Rotate90CWButtonClick += _toolBar_Rotate90CWButtonClick;
			_toolBar.Rotate90CCWButtonClick += _toolBar_Rotate90CCWButtonClick;
			_toolBar.ZoomInButtonClick += _toolBar_ZoomInButtonClick;
			_toolBar.ZoomOutButtonClick += _toolBar_ZoomOutButtonClick;
			_toolBar.ThumbnailSizeChanged += _toolBar_ThumbnailSizeChanged;
			_toolBar.Parent = this;

			_imageTracker = new ImageTracker();

			_gridPanel = new GridPanel(serviceProvider, _imageTracker);
			_gridPanel.Layout += _gridPanel_Layout;
			_gridPanel.ModeChanged += _layoutPanel_ModeChanged;
			_gridPanel.RightToLeftChanged += _gridPanel_RightToLeftChanged;
			_gridPanel.ThumbnailSizeChanged += _gridPanel_ThumbnailSizeChanged;
			_gridPanel.Visible = false;
			_gridPanel.Parent = this;

			_loupePanel = new LoupePanel(serviceProvider, _imageTracker);
			_loupePanel.ModeChanged += _layoutPanel_ModeChanged;
			_loupePanel.Visible = false;
			_loupePanel.Parent = this;

			this.RebuildLayout();
		}