/// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (!m_bVisible) return;

            int nX = e.X - this.AutoScrollPosition.X;
            int nY = e.Y - this.AutoScrollPosition.Y;

            //
            m_MouseDownPosition = new Point(nX, nY);

            if (IsMouseInImageBoxBounds(nX, nY, 2))
            {
                if (e.Button == m_nRectMoveMouseButton)
                {
                    if (m_bAllowMouseMove)
                    {
                        m_nImageBoxMode = ImageBoxMode.Move;
                        m_nRectMousePosX = nX - m_ImageBoxRect.X;
                        m_nRectMousePosY = nY - m_ImageBoxRect.Y;
                        Cursor.Current = Cursors.SizeAll;
                    }
                }

                // Fire rectangle mouse down event.
                OnImageBoxMouseDown(this,
                    new ImageBoxMouseEventArgs(e, m_ImageBoxRect));
            }
            else
            {
                if (e.Button == m_nRectResizeMouseButton)
                {
                    if (m_bAllowMouseResize)
                    {
                        ImageBoxBounds nOnBounds;

                        if (IsMouseOnImageBoxBounds(nX, nY, ImageBoxBounds.Any, out nOnBounds))
                        {
                            m_nImageBoxMode = ImageBoxMode.Resize;
                            m_nBoundsSelected = nOnBounds;

                            switch (nOnBounds)
                            {
                                case ImageBoxBounds.None:
                                    Cursor.Current = Cursors.Default;
                                    break;
                                case ImageBoxBounds.Top:
                                    Cursor.Current = Cursors.SizeNS;
                                    break;
                                case ImageBoxBounds.Bottom:
                                    Cursor.Current = Cursors.SizeNS;
                                    break;
                                case ImageBoxBounds.Left:
                                    Cursor.Current = Cursors.SizeWE;
                                    break;
                                case ImageBoxBounds.Right:
                                    Cursor.Current = Cursors.SizeWE;
                                    break;
                                case ImageBoxBounds.TopLeft:
                                    Cursor.Current = Cursors.SizeNWSE;
                                    break;
                                case ImageBoxBounds.TopRight:
                                    Cursor.Current = Cursors.SizeNESW;
                                    break;
                                case ImageBoxBounds.BottomLeft:
                                    Cursor.Current = Cursors.SizeNESW;
                                    break;
                                case ImageBoxBounds.BottomRight:
                                    Cursor.Current = Cursors.SizeNWSE;
                                    break;
                            }
                        }
                    }
                }
            }

            if (m_bFocusControl)
            {
                if (!this.Focused)
                    this.Focus();
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            if (!m_bVisible) return;

            // Set flags.
            m_nImageBoxMode = ImageBoxMode.None;
            m_nBoundsSelected = ImageBoxBounds.None;
            m_MouseDownPosition = Point.Empty;

            if (IsMouseInImageBoxBounds(e.X - this.AutoScrollPosition.X, e.Y - this.AutoScrollPosition.Y, 2))
            {
                OnImageBoxMouseUp(this,
                    new ImageBoxMouseEventArgs(e, m_ImageBoxRect));
            }
        }