示例#1
0
 void CustomSplitter_SplitterMoved(object sender, SplitterEventArgs e)
 {
     if (m_IsInternalCall)
     {
         m_IsInternalCall = false;
         if (m_LastSplitterPos == 0)
         {
             m_LastSplitterPos = m_Panel1MinSize; //arbitary
         }
         return;
     }
     if (this.Orientation == Orientation.Vertical)
     {
         if (this.SplitterDistance == 0)
         {
             this.m_Panel1State = SplitterPanelState.Retracted;
             this.Invalidate();
         }
         else if (this.SplitterDistance == (this.Width - this.SplitterWidth))
         {
             this.m_Panel2State = SplitterPanelState.Retracted;
             this.Invalidate();
         }
         else
         {
             this.m_Panel1State = SplitterPanelState.Expanded;
             this.m_Panel2State = SplitterPanelState.Expanded;
         }
     }
     else
     {
         if (this.SplitterDistance == 0)
         {
             this.m_Panel1State = SplitterPanelState.Retracted;
             this.Invalidate();
         }
         else if (this.SplitterDistance == (this.Height - this.SplitterWidth))
         {
             this.m_Panel2State = SplitterPanelState.Retracted;
             this.Invalidate();
         }
         else
         {
             this.m_Panel1State = SplitterPanelState.Expanded;
             this.m_Panel2State = SplitterPanelState.Expanded;
         }
     }
 }
 void CustomSplitter_SplitterMoved(object sender, SplitterEventArgs e)
 {
     if (m_IsInternalCall)
     {
         m_IsInternalCall = false;
         if (m_LastSplitterPos == 0)
             m_LastSplitterPos = m_Panel1MinSize; //arbitary
         return;
     }
     if (this.Orientation == Orientation.Vertical)
     {
         if (this.SplitterDistance == 0)
         {
             this.m_Panel1State = SplitterPanelState.Retracted;
             this.Invalidate();
         }
         else if (this.SplitterDistance == (this.Width - this.SplitterWidth))
         {
             this.m_Panel2State = SplitterPanelState.Retracted;
             this.Invalidate();
         }
         else
         {
             this.m_Panel1State = SplitterPanelState.Expanded;
             this.m_Panel2State = SplitterPanelState.Expanded;
         }
     }
     else
     {
         if (this.SplitterDistance == 0)
         {
             this.m_Panel1State = SplitterPanelState.Retracted;
             this.Invalidate();
         }
         else if (this.SplitterDistance == (this.Height - this.SplitterWidth))
         {
             this.m_Panel2State = SplitterPanelState.Retracted;
             this.Invalidate();
         }
         else
         {
             this.m_Panel1State = SplitterPanelState.Expanded;
             this.m_Panel2State = SplitterPanelState.Expanded;
         }
     }
 }
        protected override void OnClick(EventArgs e)
        {
            if (m_IsHot)
            {

                Point ptC = new Point(Cursor.Position.X, Cursor.Position.Y);
                Point pt = this.PointToClient(ptC);

                if (this.m_RectLeftArrow.Contains(pt))
                {
                    if (this.m_Panel2State == SplitterPanelState.Retracted)
                    {
                        this.m_Panel2State = SplitterPanelState.Expanded;
                        m_TimerValueToSet = m_LastSplitterPos;
                        m_Timer.Start();
                        this.Panel1MinSize = m_Panel1MinSize;
                    }
                    else if (this.m_Panel1State == SplitterPanelState.Expanded)
                    {
                        this.m_Panel1State = SplitterPanelState.Retracted;
                        m_LastSplitterPos = this.SplitterDistance;
                        this.Panel1MinSize = 0;
                        m_TimerValueToSet = 0;
                        m_Timer.Start();
                    }
                    else
                    {
                        this.m_Panel1State = SplitterPanelState.Expanded;
                        m_TimerValueToSet = m_LastSplitterPos;
                        m_Timer.Start();
                        this.Panel1MinSize = m_Panel1MinSize;
                    }
                    this.Invalidate();
                }
                else if (this.m_RectRightArrow.Contains(pt))
                {
                    if (this.m_Panel1State == SplitterPanelState.Retracted)
                    {
                        this.m_Panel1State = SplitterPanelState.Expanded;
                        m_TimerValueToSet = m_LastSplitterPos;
                        m_Timer.Start();
                        this.Panel2MinSize = m_Panel2MinSize;
                    }
                    else if (this.m_Panel2State == SplitterPanelState.Expanded)
                    {
                        this.m_Panel2State = SplitterPanelState.Retracted;
                        m_LastSplitterPos = this.SplitterDistance;
                        this.Panel2MinSize = 0;
                        m_TimerValueToSet = this.Width - this.SplitterWidth;
                        m_Timer.Start();
                    }
                    else
                    {
                        this.m_Panel2State = SplitterPanelState.Expanded;
                        m_TimerValueToSet = m_LastSplitterPos;
                        m_Timer.Start();
                        this.Panel2MinSize = m_Panel2MinSize;
                    }
                    this.Invalidate();
                }
                else
                    base.OnClick(e);
            }
            else
                base.OnClick(e);
        }
示例#4
0
        protected override void OnClick(EventArgs e)
        {
            if (m_IsHot)
            {
                Point ptC = new Point(Cursor.Position.X, Cursor.Position.Y);
                Point pt  = this.PointToClient(ptC);

                if (this.m_RectLeftArrow.Contains(pt))
                {
                    if (this.m_Panel2State == SplitterPanelState.Retracted)
                    {
                        this.m_Panel2State = SplitterPanelState.Expanded;
                        m_TimerValueToSet  = m_LastSplitterPos;
                        m_Timer.Start();
                        this.Panel1MinSize = m_Panel1MinSize;
                    }
                    else if (this.m_Panel1State == SplitterPanelState.Expanded)
                    {
                        this.m_Panel1State = SplitterPanelState.Retracted;
                        m_LastSplitterPos  = this.SplitterDistance;
                        this.Panel1MinSize = 0;
                        m_TimerValueToSet  = 0;
                        m_Timer.Start();
                    }
                    else
                    {
                        this.m_Panel1State = SplitterPanelState.Expanded;
                        m_TimerValueToSet  = m_LastSplitterPos;
                        m_Timer.Start();
                        this.Panel1MinSize = m_Panel1MinSize;
                    }
                    this.Invalidate();
                }
                else if (this.m_RectRightArrow.Contains(pt))
                {
                    if (this.m_Panel1State == SplitterPanelState.Retracted)
                    {
                        this.m_Panel1State = SplitterPanelState.Expanded;
                        m_TimerValueToSet  = m_LastSplitterPos;
                        m_Timer.Start();
                        this.Panel2MinSize = m_Panel2MinSize;
                    }
                    else if (this.m_Panel2State == SplitterPanelState.Expanded)
                    {
                        this.m_Panel2State = SplitterPanelState.Retracted;
                        m_LastSplitterPos  = this.SplitterDistance;
                        this.Panel2MinSize = 0;
                        m_TimerValueToSet  = this.Width - this.SplitterWidth;
                        m_Timer.Start();
                    }
                    else
                    {
                        this.m_Panel2State = SplitterPanelState.Expanded;
                        m_TimerValueToSet  = m_LastSplitterPos;
                        m_Timer.Start();
                        this.Panel2MinSize = m_Panel2MinSize;
                    }
                    this.Invalidate();
                }
                else
                {
                    base.OnClick(e);
                }
            }
            else
            {
                base.OnClick(e);
            }
        }