/// <summary>
        /// The constructor of the floating window
        /// </summary>
        public FloatWindow()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            m_floatItem		= null;
            m_bShowForm		= false;
            m_iShowRatio	= 0;
        }
        /// <summary>
        /// Show the floating window
        /// </summary>
        /// <param name="item">The float item to be docked in</param>
        public void AnimateShowFloatWindow(FloatItem item)
        {
            if (m_floatItem != null)
            {
                m_floatItem.m_bar.FireHiding(m_floatItem);
            }

            m_iShowRatio	= 0;
            m_bShowForm		= true;
            m_floatItem		= item;

            this.pbIcon.Image	= item.m_icon;
            this.lbTitle.Text	= item.m_caption;
            this.Owner			= item.m_bar.ParentForm;
            this.Width			= 0;
            this.Height			= 0;

            item.m_control.Parent	= this;
            item.m_control.Visible	= true;
            item.m_control.Dock		= DockStyle.None;
            item.m_control.Enabled	= false;
            item.m_control.BringToFront();

            this.tmFloat.Enabled = true;
        }
        /// <summary>
        /// Show the float window step by step
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tmFloat_Tick(object sender, System.EventArgs e)
        {
            if (m_floatItem != null)
            {
                Point		pt = m_floatItem.m_bar.PointToScreen(new Point(0, 0));
                Rectangle	rc = new Rectangle();

                if (this.m_bShowForm)
                {
                    m_iShowRatio += 1;
                }
                else
                {
                    m_iShowRatio -= 1;
                }

                this.Visible	= true;

                switch (m_floatItem.m_bar.Dock)
                {
                    case DockStyle.Top:
                    {
                        rc.X		= pt.X;
                        rc.Y		= pt.Y + m_floatItem.m_bar.Height;
                        rc.Height	= m_floatItem.m_floatSize * m_iShowRatio / 10;
                        rc.Width	= m_floatItem.m_bar.Width;
                        this.Bounds = rc;

                        m_floatItem.m_control.Left		= 0;
                        m_floatItem.m_control.Top		= this.ClientSize.Height - m_floatItem.m_floatSize - plSpacer.Bottom;
                        m_floatItem.m_control.Height	= m_floatItem.m_floatSize - plSpacer.Bottom;
                        m_floatItem.m_control.Width		= this.ClientSize.Width;

                        break;
                    }
                    case DockStyle.Bottom:
                    {
                        rc.X		= pt.X;
                        rc.Y		= pt.Y - m_floatItem.m_floatSize * m_iShowRatio / 10;
                        rc.Height	= m_floatItem.m_floatSize * m_iShowRatio / 10;
                        rc.Width	= m_floatItem.m_bar.Width;
                        this.Bounds = rc;

                        m_floatItem.m_control.Left		= 0;
                        m_floatItem.m_control.Top		= 0;
                        m_floatItem.m_control.Height	= m_floatItem.m_floatSize - plSpacer.Bottom;
                        m_floatItem.m_control.Width		= this.ClientSize.Width;

                        break;
                    }
                    case DockStyle.Left:
                    {
                        rc.X		= pt.X + m_floatItem.m_bar.Width;
                        rc.Y		= pt.Y;
                        rc.Height	= m_floatItem.m_bar.Height;
                        rc.Width	= m_floatItem.m_floatSize * m_iShowRatio / 10;
                        this.Bounds = rc;

                        m_floatItem.m_control.Left		= this.ClientSize.Width - m_floatItem.m_floatSize;
                        m_floatItem.m_control.Top		= plSpacer.Bottom;
                        m_floatItem.m_control.Height	= this.ClientSize.Height - plSpacer.Bottom;
                        m_floatItem.m_control.Width		= m_floatItem.m_floatSize;

                        break;
                    }
                    case DockStyle.Right:
                    {
                        rc.X		= pt.X - m_floatItem.m_floatSize * m_iShowRatio / 10;
                        rc.Y		= pt.Y;
                        rc.Height	= m_floatItem.m_bar.Height;
                        rc.Width	= m_floatItem.m_floatSize * m_iShowRatio / 10;
                        this.Bounds = rc;

                        m_floatItem.m_control.Left		= 0;
                        m_floatItem.m_control.Top		= plSpacer.Bottom;
                        m_floatItem.m_control.Height	= this.ClientSize.Height - plSpacer.Bottom;
                        m_floatItem.m_control.Width		= m_floatItem.m_floatSize;

                        break;
                    }
                }

                this.Refresh();

                if (m_iShowRatio == 11)
                {
                    m_floatItem.m_control.Dock		= System.Windows.Forms.DockStyle.Fill;
                    m_floatItem.m_control.Enabled	= true;
                    tmFloat.Enabled = false;
                }

                if (m_iShowRatio == 0)
                {
                    tmFloat.Enabled = false;
                    this.Visible = false;
                    m_floatItem.m_control.Parent	= null;
                    m_floatItem.m_control.Enabled	= true;
                    m_floatItem = null;
                }
            }
        }
 /// <summary>
 /// Remove a float item
 /// </summary>
 /// <param name="item">The float item to be removed</param>
 public void RemoveFloatWindow(FloatItem item)
 {
     m_rgFloatItems.Remove(item);
     item.Dispose();
 }
        /// <summary>
        /// Hide the float window immediately
        /// </summary>
        public void HideFloatWindow()
        {
            if (m_floatItem != null)
            {
                m_floatItem.m_bar.FireHiding(m_floatItem);
            }

            this.Width		= 0;
            this.Height		= 0;
            this.Visible	= false;

            if (m_floatItem != null)
            {
                m_floatItem.m_control.Parent = null;
                m_floatItem = null;
            }
        }
        public void RelayoutBySelection(FloatItem selectedItem)
        {
            if ((this.Dock == DockStyle.Left) || (this.Dock == DockStyle.Right))
            {
                selectedItem.m_label.Height = selectedItem.m_labelSize;

                for (int i = 0; i < this.FloatWindowCount; i++)
                {
                    if (this.FloatWindows(i).m_hideCaptionOnUnselected)
                    {
                        if (!this.FloatWindows(i).Equals(selectedItem))
                        {
                            this.FloatWindows(i).m_label.Height = this.FloatWindows(i).m_icon.Height + 5;
                        }
                    }
                }
            }
            else if ((this.Dock == DockStyle.Top) || (this.Dock == DockStyle.Bottom))
            {
                selectedItem.m_label.Width = selectedItem.m_labelSize;

                for (int i = 0; i < this.FloatWindowCount; i++)
                {
                    if (this.FloatWindows(i).m_hideCaptionOnUnselected)
                    {
                        if (!this.FloatWindows(i).Equals(selectedItem))
                        {
                            this.FloatWindows(i).m_label.Width = this.FloatWindows(i).m_icon.Width + 5;
                        }
                    }
                }
            }
            this.PerformLayout();
        }
 /// <summary>
 /// Fire the FloatWindowHiding event
 /// </summary>
 /// <param name="item"></param>
 public void FireHiding(FloatItem item)
 {
     if (FloatWindowHiding != null)
     {
         FloatWindowHiding(item.m_control);
     }
 }
        /// <summary>
        /// Fire the FloatItemDocking event
        /// </summary>
        /// <param name="item"></param>
        public void FireDocking(FloatItem item)
        {
            bool	bCanceled = false;

            if (FloatItemDocking != null)
            {
                FloatItemDocking(item.m_control, item.m_icon, item.m_caption, ref bCanceled);
            }

            if (!bCanceled)
            {
                m_frmFloat.HideFloatWindow();
                this.RemoveFloatWindow(item);
            }
        }
        /// <summary>
        /// Show a float item
        /// </summary>
        /// <param name="item"></param>
        public void AnimateShowFloatWindow(FloatItem item)
        {
            if (m_frmFloat.ActiveItem != null)
            {
                if (m_frmFloat.ActiveItem.Equals(item))
                {
                    return;
                }
            }

            RelayoutBySelection(item);

            m_frmFloat.HideFloatWindow();
            m_frmFloat.AnimateShowFloatWindow(item);
        }
        /// <summary>
        /// Add a control to the float bar
        /// </summary>
        /// <param name="floatControl">The control to be shown</param>
        /// <param name="icon">The icon of the control</param>
        /// <param name="caption">The caption of the control</param>
        /// <param name="floatSize">The size of the float window of this control</param>
        /// <param name="labelSize">The size of label of this control on the float bar</param>
        public FloatItem AddFloatWindow(Control floatControl, Image icon, string caption, int floatSize, int labelSize, bool hideCaptionOnUnselected)
        {
            FloatItem	item;

            item = new FloatItem(this, floatControl, icon, caption, floatSize, labelSize, hideCaptionOnUnselected);
            m_rgFloatItems.Add(item);

            return item;
        }