Exemplo n.º 1
0
		/// <summary>
		/// Estimates the docking position and size of a given bar for outline purposes during drag&drop
		/// </summary>
		/// <param name="bar">Bar to find estimated docking position and size for</param>
		/// <param name="pDockInfo">Docking information</param>
		/// <returns>Preview Rectangle in screen coordinates.</returns>
		internal Rectangle GetDockPreviewRectangle(Bar bar, ref DockSiteInfo dockInfo)
		{
			DocumentBaseContainer referenceDoc=GetDocumentFromBar(dockInfo.MouseOverBar);
			Rectangle r=Rectangle .Empty;

            // Handle edge case docking first
            if (m_Container.Dock!= DockStyle.Fill && (dockInfo.DockLine == 999 || dockInfo.DockLine == -1))
            {
                return GetEdgeDockPreviewRectangle(bar, ref dockInfo);
            }
			else if(referenceDoc!=null)
			{
				if(dockInfo.MouseOverDockSide==eDockSide.Left)
				{
					r=referenceDoc.DisplayBounds;
					r.Width=r.Width/2;
				}
				else if(dockInfo.MouseOverDockSide==eDockSide.Right)
				{
					r=referenceDoc.DisplayBounds;
					r.X+=r.Width/2;
					r.Width=r.Width/2;
				}
				else if(dockInfo.MouseOverDockSide==eDockSide.Top)
				{
					r=referenceDoc.DisplayBounds;
					r.Height=r.Height/2;
				}
				else if(dockInfo.MouseOverDockSide==eDockSide.Bottom)
				{
					r=referenceDoc.DisplayBounds;
					r.Y+=r.Height/2;
					r.Height=r.Height/2;
				}
				else if(dockInfo.MouseOverDockSide==eDockSide.Document)
				{
					r=referenceDoc.DisplayBounds;
				}
				r.Location=m_Container.PointToScreen(r.Location);
			}
			else
			{
                if (m_Container.Dock == DockStyle.Fill)
                {
                    r = m_Container.ClientRectangle;
                    r.Location = m_Container.PointToScreen(r.Location);
                }
                else if (m_Container.Dock == DockStyle.Right)
                {
                    r = m_Container.ClientRectangle;
                    r.Location = m_Container.PointToScreen(r.Location);
                    if (r.Width == 0)
                    {
                        r.Width = bar.GetBarDockedSize(eOrientation.Vertical);
                        r.X -= r.Width;
                    }
                }
                else if (m_Container.Dock == DockStyle.Left)
                {
                    r = m_Container.ClientRectangle;
                    r.Location = m_Container.PointToScreen(r.Location);
                    if (r.Width == 0)
                    {
                        r.Width = bar.GetBarDockedSize(eOrientation.Vertical);
                    }
                }
                else if (m_Container.Dock == DockStyle.Top)
                {
                    r = m_Container.ClientRectangle;
                    r.Location = m_Container.PointToScreen(r.Location);
                    if (r.Height == 0)
                    {
                        r.Height = bar.GetBarDockedSize(eOrientation.Horizontal);
                    }
                }
                else if (m_Container.Dock == DockStyle.Bottom)
                {
                    r = m_Container.ClientRectangle;
                    r.Location = m_Container.PointToScreen(r.Location);
                    if (r.Height == 0)
                    {
                        r.Height = bar.GetBarDockedSize(eOrientation.Horizontal);
                        r.Y -= r.Height;
                    }
                }
			}

			return r;
		}
Exemplo n.º 2
0
        /// <summary>
        /// Adjusts the size of the dock container if needed after a bar has been docked to it.
        /// </summary>
        /// <param name="barToDock">Bar object that has been docked.</param>
        /// <param name="visibleChanged">Indicates that bar was already docked but its Visible property has changed</param>
        internal void AdjustContainerSize(Bar barToDock, bool visibleChanged)
        {
            if (m_Container.Owner != null && m_Container.Owner.IsLoadingLayout) return;

            // Adjust the size of the container since it dictates the size of the bars docked inside
            if (m_Container.Dock != DockStyle.Fill)
            {
                DocumentBaseContainer doc = this.GetDocumentFromBar(barToDock);
                if (doc == null) return;
                if (m_Container.Dock == DockStyle.Left || m_Container.Dock == DockStyle.Right)
                {
                    if (m_Container.Width == 0 || doc.Parent == m_DocumentDockContainer &&
                        (m_DocumentDockContainer.Orientation == eOrientation.Horizontal || visibleChanged && m_DocumentDockContainer.Documents.Count == 1))
                    {
                        int width = barToDock.GetBarDockedSize(eOrientation.Vertical);
                        if (barToDock.Width > 0 && barToDock.Width<m_Container.Width) width = barToDock.Width;
                        int clientWidth = GetClientWidth();

                        if (barToDock.Visible)
                        {
                            if (width > clientWidth)
                                width = barToDock.MinimumDockSize(eOrientation.Vertical).Width * 2;
                            if (width > clientWidth)
                                width = barToDock.MinimumDockSize(eOrientation.Vertical).Width;
                        }
                        
						if(doc.LayoutBounds.Width == 0)
							doc.SetLayoutBounds(new Rectangle(doc.LayoutBounds.X, doc.LayoutBounds.Y, width, doc.LayoutBounds.Height));
                        width += m_DocumentDockContainer.SplitterSize;
                        if (visibleChanged)
                        {
                            if(barToDock.Visible)
                                m_Container.Width += width;
                            else if(m_Container.Width>0)
                                m_Container.Width -= Math.Min(width, m_Container.Width);
                        }
                        else
                            m_Container.Width += width;
                        m_Container.Invalidate();
                    }
                }
                else if (m_Container.Dock == DockStyle.Top || m_Container.Dock == DockStyle.Bottom)
                {
                    if (m_Container.Height == 0 || doc.Parent == m_DocumentDockContainer &&
                        (m_DocumentDockContainer.Orientation == eOrientation.Vertical || visibleChanged && m_DocumentDockContainer.Documents.Count == 1))
                    {
                        int height = barToDock.GetBarDockedSize(eOrientation.Horizontal);
                        if (barToDock.Height > 0 && barToDock.Height<m_Container.Height) height = barToDock.Height;
                        int clientHeight = GetClientHeight();

                        if (barToDock.Visible)
                        {
                            if (height > clientHeight)
                                height = barToDock.MinimumDockSize(eOrientation.Horizontal).Height * 2;
                            if (height > clientHeight)
                                height = barToDock.MinimumDockSize(eOrientation.Horizontal).Height;
                        }
                        
						if(doc.LayoutBounds.Height == 0)
							doc.SetLayoutBounds(new Rectangle(doc.LayoutBounds.X, doc.LayoutBounds.Y, doc.LayoutBounds.Width, height));
                        height += m_DocumentDockContainer.SplitterSize;
                        if (visibleChanged)
                        {
                            if (barToDock.Visible)
                                m_Container.Height += height;
                            else if (m_Container.Height > 0)
                                m_Container.Height -= Math.Min(height, m_Container.Height);
                        }
                        else
                            m_Container.Height += height;
                        m_Container.Invalidate();
                    }
                }
            }
        }
Exemplo n.º 3
0
        private Rectangle GetEdgeDockPreviewRectangle(Bar bar, ref DockSiteInfo dockInfo)
        {
            Rectangle r = Rectangle.Empty;
            int fullSizeIndex = -1;
            int partialSizeIndex = -1;
            if (dockInfo.FullSizeDock)
                fullSizeIndex = m_Container.GetFullSizeIndex();
            else if (dockInfo.PartialSizeDock)
                partialSizeIndex = m_Container.GetPartialSizeIndex();

            // Docks the bar to the edge
            switch (m_Container.Dock)
            {
                case DockStyle.Top:
                    {
                        r.Width = m_Container.ClientRectangle.Width;
                        r.Height = bar.GetBarDockedSize(eOrientation.Horizontal);

                        if (fullSizeIndex >= 0)
                        {
                            r.Width += m_Container.GetSiteZOrderSize(m_Container.Owner.LeftDockSite, true).Width;
                            r.Width += m_Container.GetSiteZOrderSize(m_Container.Owner.RightDockSite, true).Width;
                            dockInfo.DockSiteZOrderIndex = fullSizeIndex;
                        }
                        else if (partialSizeIndex >= 0)
                        {
                            // Reduce by the size of the left and right dock site
                            r.Width -= m_Container.GetSiteZOrderSize(m_Container.Owner.LeftDockSite, false).Width;
                            r.Width -= m_Container.GetSiteZOrderSize(m_Container.Owner.RightDockSite, false).Width;
                            dockInfo.DockSiteZOrderIndex = partialSizeIndex;

                        }

                        Point p = Point.Empty;
                        if (dockInfo.DockLine == -1)
                        {
                            p = m_Container.PointToScreen(m_Container.ClientRectangle.Location);
                        }
                        else
                        {
                            p = m_Container.PointToScreen(new Point(m_Container.ClientRectangle.X, m_Container.ClientRectangle.Bottom));
                            p.Y++;
                        }
                        if (fullSizeIndex >= 0)
                            p.X -= m_Container.GetSiteZOrderSize(m_Container.Owner.LeftDockSite, true).Width;
                        else if (partialSizeIndex >= 0)
                            p.X += m_Container.GetSiteZOrderSize(m_Container.Owner.LeftDockSite, false).Width;
                        r.Location = p;
                        break;
                    }
                case DockStyle.Bottom:
                    {
                        r.Width = m_Container.ClientRectangle.Width;
                        r.Height = bar.GetBarDockedSize(eOrientation.Horizontal);
                        if (fullSizeIndex >= 0)
                        {
                            r.Width += m_Container.GetSiteZOrderSize(m_Container.Owner.LeftDockSite, true).Width;
                            r.Width += m_Container.GetSiteZOrderSize(m_Container.Owner.RightDockSite, true).Width;
                            dockInfo.DockSiteZOrderIndex = fullSizeIndex;
                        }
                        else if (partialSizeIndex >= 0)
                        {
                            // Reduce by the size of the left and right dock site
                            r.Width -= m_Container.GetSiteZOrderSize(m_Container.Owner.LeftDockSite, false).Width;
                            r.Width -= m_Container.GetSiteZOrderSize(m_Container.Owner.RightDockSite, false).Width;
                            dockInfo.DockSiteZOrderIndex = partialSizeIndex;

                        }

                        Point p = Point.Empty;
                        if (dockInfo.DockLine == -1)
                        {
                            p = m_Container.PointToScreen(new Point(m_Container.ClientRectangle.X, m_Container.ClientRectangle.Y - r.Height));
                        }
                        else
                        {
                            p = m_Container.PointToScreen(new Point(m_Container.ClientRectangle.X, m_Container.ClientRectangle.Bottom - r.Height));
                            p.Y++;
                        }
                        if (fullSizeIndex >= 0)
                            p.X -= m_Container.GetSiteZOrderSize(m_Container.Owner.LeftDockSite, true).Width;
                        else if (partialSizeIndex >= 0)
                            p.X += m_Container.GetSiteZOrderSize(m_Container.Owner.LeftDockSite, false).Width;
                        r.Location = p;
                        break;
                    }
                case DockStyle.Right:
                    {
                        r.Height = m_Container.ClientRectangle.Height;

                        if (fullSizeIndex >= 0)
                        {
                            r.Height += m_Container.GetSiteZOrderSize(m_Container.Owner.TopDockSite, true).Height;
                            r.Height += m_Container.GetSiteZOrderSize(m_Container.Owner.BottomDockSite, true).Height;
                            dockInfo.DockSiteZOrderIndex = fullSizeIndex;
                        }
                        else if (partialSizeIndex >= 0)
                        {
                            // Reduce by the size of the top and bottom dock site
                            r.Height -= m_Container.GetSiteZOrderSize(m_Container.Owner.TopDockSite, false).Height;
                            r.Height -= m_Container.GetSiteZOrderSize(m_Container.Owner.BottomDockSite, false).Height;
                            dockInfo.DockSiteZOrderIndex = partialSizeIndex;

                        }

                        r.Width = bar.GetBarDockedSize(eOrientation.Vertical);
                        Point p = Point.Empty;
                        if (dockInfo.DockLine == -1)
                        {
                            p = m_Container.PointToScreen(new Point(m_Container.ClientRectangle.X - r.Width, m_Container.ClientRectangle.Y));
                        }
                        else
                        {
                            p = m_Container.PointToScreen(new Point(m_Container.ClientRectangle.Right - r.Width, m_Container.ClientRectangle.Y));
                            p.X--;
                        }
                        if (fullSizeIndex >= 0)
                            p.Y -= m_Container.GetSiteZOrderSize(m_Container.Owner.TopDockSite, true).Height;
                        else if (partialSizeIndex >= 0)
                            p.Y += m_Container.GetSiteZOrderSize(m_Container.Owner.TopDockSite, false).Height;
                        r.Location = p;
                        break;
                    }
                default:
                    {
                        r.Height = m_Container.ClientRectangle.Height;
                        if (fullSizeIndex >= 0)
                        {
                            r.Height += m_Container.GetSiteZOrderSize(m_Container.Owner.TopDockSite, true).Height;
                            r.Height += m_Container.GetSiteZOrderSize(m_Container.Owner.BottomDockSite, true).Height;
                            dockInfo.DockSiteZOrderIndex = fullSizeIndex;
                        }
                        else if (partialSizeIndex >= 0)
                        {
                            // Reduce by the size of the top and bottom dock site
                            r.Height -= m_Container.GetSiteZOrderSize(m_Container.Owner.TopDockSite, false).Height;
                            r.Height -= m_Container.GetSiteZOrderSize(m_Container.Owner.BottomDockSite, false).Height;
                            dockInfo.DockSiteZOrderIndex = partialSizeIndex;

                        }
                        r.Width = bar.GetBarDockedSize(eOrientation.Vertical);

                        Point p = Point.Empty;
                        if (dockInfo.DockLine == -1)
                        {
                            p = m_Container.PointToScreen(new Point(m_Container.ClientRectangle.X, m_Container.ClientRectangle.Y));
                        }
                        else
                        {
                            p = m_Container.PointToScreen(new Point(m_Container.ClientRectangle.Right, m_Container.ClientRectangle.Y));
                            p.X++;
                        }
                        if (fullSizeIndex >= 0)
                            p.Y -= m_Container.GetSiteZOrderSize(m_Container.Owner.TopDockSite, true).Height;
                        else if (partialSizeIndex >= 0)
                            p.Y += m_Container.GetSiteZOrderSize(m_Container.Owner.TopDockSite, false).Height;
                        r.Location = p;
                        break;
                    }
            }

            return r;
        }
Exemplo n.º 4
0
		/// <summary>
		/// Sets the height of the bar that is managed by this document layout. Height can be set only if parent container has
		/// vertical orientation. Note that bar minimum size is respected by this method and
		/// it will be enforced. If height is less than minimum height bar's height will be set to minimum height.
		/// </summary>
		/// <param name="bar">Reference to bar object.</param>
		/// <param name="height">Desired height.</param>
		public void SetBarHeight(Bar bar, int height)
		{
			DocumentBarContainer docBar=GetDocumentFromBar(bar) as DocumentBarContainer;
			if(docBar==null)
				return;

            if (m_Container!=null && (m_Container.Dock == DockStyle.Top || m_Container.Dock== DockStyle.Bottom) && 
                docBar.Parent == m_DocumentDockContainer
                /*&& (m_DocumentDockContainer.Orientation == eOrientation.Horizontal || m_DocumentDockContainer.Documents.Count == 1)*/)
            {
                //m_Container.Height += (height - bar.Height);
                //m_DocumentDockContainer.SetHeight(height);
                m_Container.SuspendLayout();
                int diff = height;
                if (docBar.DisplayBounds.Height == 0)
                    diff -= bar.GetBarDockedSize(eOrientation.Vertical);
                else
                    diff -= docBar.DisplayBounds.Height;
                m_Container.Height += diff;
                //((DocumentDockContainer)docBar.Parent).SetHeight(height);
                docBar.SetHeight(height);
                m_Container.ResumeLayout(true);
            }
            else if (docBar.Parent is DocumentDockContainer && ((DocumentDockContainer)docBar.Parent).Orientation == eOrientation.Horizontal)
            {
                ((DocumentDockContainer)docBar.Parent).SetHeight(height);
            }
            else
            {
                if (height < docBar.MinimumSize.Height)
                    height = docBar.MinimumSize.Height;
                docBar.SetHeight(height);
            }
			m_Container.RecalcLayout();
		}
Exemplo n.º 5
0
		/// <summary>
		/// Sets the width of the bar that is managed by this document layout. Width can be set only if parent container has
		/// Horizontal orientation. Note that bar minimum size is respected by this method and
		/// it will be enforced. If width is less than minimum width bar's width will be set to minimum width.
		/// </summary>
		/// <param name="bar">Reference to bar object.</param>
		/// <param name="width">Desired width.</param>
		public void SetBarWidth(Bar bar, int width)
		{
			DocumentBarContainer docBar=GetDocumentFromBar(bar) as DocumentBarContainer;
			if(docBar==null)
				return;
			if(docBar.Parent == m_DocumentDockContainer && (m_Container.Dock == DockStyle.Left || m_Container.Dock == DockStyle.Right)
				/*&& (m_DocumentDockContainer.Orientation == eOrientation.Vertical || m_DocumentDockContainer.Documents.Count == 1)*/)
			{
				m_Container.SuspendLayout();
				int diff = width;
				if(docBar.DisplayBounds.Width == 0)
					diff -= bar.GetBarDockedSize(eOrientation.Vertical);
				else
					diff -= docBar.DisplayBounds.Width;
                if (diff != 0)
                {
                    m_Container.Width += diff;
                    docBar.SetWidth(width);
                }
				//((DocumentDockContainer)docBar.Parent).SetWidth(width);
				m_Container.ResumeLayout(true);
			}
            else if (docBar.Parent is DocumentDockContainer && ((DocumentDockContainer)docBar.Parent).Orientation == eOrientation.Vertical)
            {
                ((DocumentDockContainer)docBar.Parent).SetWidth(width);
            }
            else
            {
                if (width < docBar.MinimumSize.Width)
                    width = docBar.MinimumSize.Width;
                docBar.SetWidth(width);
            }
			m_Container.RecalcLayout();
		}
Exemplo n.º 6
0
        public Rectangle GetBarDockRectangle(Bar bar, ref DockSiteInfo pDockInfo)
		{
			if(pDockInfo.objDockSite==null)
				return Rectangle.Empty;

			if(pDockInfo.objDockSite.Dock==DockStyle.Fill || m_DocumentDockContainer!=null)
			{
				DocumentDockUIManager m_UIManager=GetDocumentUIManager();
				return m_UIManager.GetDockPreviewRectangle(bar,ref pDockInfo);
			}
			
			Rectangle r=Rectangle.Empty;

			if(pDockInfo.InsertPosition<0 && pDockInfo.NewLine)
				pDockInfo.DockLine=-1;
			else if(pDockInfo.InsertPosition>=this.Controls.Count && pDockInfo.NewLine)
                pDockInfo.DockLine=999;

			if(pDockInfo.TabDockContainer!=null)
			{
				r=pDockInfo.TabDockContainer.Bounds;
				r.Location=this.PointToScreen(r.Location);
			}
			else if(pDockInfo.DockLine==999 || pDockInfo.DockLine==-1) // Handle the edge cases
			{
				int fullSizeIndex=-1;
				int partialSizeIndex=-1;
				if(pDockInfo.FullSizeDock)
					fullSizeIndex=this.GetFullSizeIndex();
				else if(pDockInfo.PartialSizeDock)
					partialSizeIndex=this.GetPartialSizeIndex();

				// Docks the bar to the edge
				switch(this.Dock)
				{
					case DockStyle.Top:
					{
						r.Width=this.ClientRectangle.Width;
						r.Height=bar.GetBarDockedSize(eOrientation.Horizontal);

						if(fullSizeIndex>=0)
						{
							r.Width+=GetSiteZOrderSize(m_Owner.LeftDockSite,true).Width;
							r.Width+=GetSiteZOrderSize(m_Owner.RightDockSite,true).Width;
							pDockInfo.DockSiteZOrderIndex=fullSizeIndex;
						}
						else if(partialSizeIndex>=0)
						{
							// Reduce by the size of the left and right dock site
							r.Width-=GetSiteZOrderSize(m_Owner.LeftDockSite,false).Width;
							r.Width-=GetSiteZOrderSize(m_Owner.RightDockSite,false).Width;
							pDockInfo.DockSiteZOrderIndex=partialSizeIndex;
							
						}

						Point p=Point.Empty;
						if(pDockInfo.DockLine==-1)
						{
							p=this.PointToScreen(this.ClientRectangle.Location);
						}
						else
						{
							p=this.PointToScreen(new Point(this.ClientRectangle.X,this.ClientRectangle.Bottom));
							p.Y++;
						}
						if(fullSizeIndex>=0)
							p.X-=GetSiteZOrderSize(m_Owner.LeftDockSite,true).Width;
						else if(partialSizeIndex>=0)
							p.X+=GetSiteZOrderSize(m_Owner.LeftDockSite,false).Width;
						r.Location=p;
						break;
					}
					case DockStyle.Bottom:
					{
						r.Width=this.ClientRectangle.Width;
						r.Height=bar.GetBarDockedSize(eOrientation.Horizontal);
						if(fullSizeIndex>=0)
						{
							r.Width+=GetSiteZOrderSize(m_Owner.LeftDockSite,true).Width;
							r.Width+=GetSiteZOrderSize(m_Owner.RightDockSite,true).Width;
							pDockInfo.DockSiteZOrderIndex=fullSizeIndex;
						}
						else if(partialSizeIndex>=0)
						{
							// Reduce by the size of the left and right dock site
							r.Width-=GetSiteZOrderSize(m_Owner.LeftDockSite,false).Width;
							r.Width-=GetSiteZOrderSize(m_Owner.RightDockSite,false).Width;
							pDockInfo.DockSiteZOrderIndex=partialSizeIndex;
							
						}

						Point p=Point.Empty;
						if(pDockInfo.DockLine==-1)
						{
							p=this.PointToScreen(new Point(this.ClientRectangle.X,this.ClientRectangle.Y-r.Height));
						}
						else
						{
							p=this.PointToScreen(new Point(this.ClientRectangle.X,this.ClientRectangle.Bottom-r.Height));
							p.Y++;
						}
						if(fullSizeIndex>=0)
							p.X-=GetSiteZOrderSize(m_Owner.LeftDockSite,true).Width;
						else if(partialSizeIndex>=0)
							p.X+=GetSiteZOrderSize(m_Owner.LeftDockSite,false).Width;
						r.Location=p;
						break;
					}
					case DockStyle.Right:
					{
						r.Height=this.ClientRectangle.Height;

						if(fullSizeIndex>=0)
						{
							r.Height+=GetSiteZOrderSize(m_Owner.TopDockSite,true).Height;
							r.Height+=GetSiteZOrderSize(m_Owner.BottomDockSite,true).Height;
							pDockInfo.DockSiteZOrderIndex=fullSizeIndex;
						}
						else if(partialSizeIndex>=0)
						{
							// Reduce by the size of the top and bottom dock site
							r.Height-=GetSiteZOrderSize(m_Owner.TopDockSite,false).Height;
							r.Height-=GetSiteZOrderSize(m_Owner.BottomDockSite,false).Height;
							pDockInfo.DockSiteZOrderIndex=partialSizeIndex;
							
						}

						r.Width=bar.GetBarDockedSize(eOrientation.Vertical);
						Point p=Point.Empty;
                        if (pDockInfo.DockLine == -1)
						{
							p=this.PointToScreen(new Point(this.ClientRectangle.X-r.Width,this.ClientRectangle.Y));
						}
						else
						{
							p=this.PointToScreen(new Point(this.ClientRectangle.Right-r.Width,this.ClientRectangle.Y));
							p.X--;	
						}
						if(fullSizeIndex>=0)
							p.Y-=GetSiteZOrderSize(m_Owner.TopDockSite,true).Height;
						else if(partialSizeIndex>=0)
							p.Y+=GetSiteZOrderSize(m_Owner.TopDockSite,false).Height;
						r.Location=p;
						break;
					}
					default:
					{
						r.Height=this.ClientRectangle.Height;
						if(fullSizeIndex>=0)
						{
							r.Height+=GetSiteZOrderSize(m_Owner.TopDockSite,true).Height;
							r.Height+=GetSiteZOrderSize(m_Owner.BottomDockSite,true).Height;
							pDockInfo.DockSiteZOrderIndex=fullSizeIndex;
						}
						else if(partialSizeIndex>=0)
						{
							// Reduce by the size of the top and bottom dock site
							r.Height-=GetSiteZOrderSize(m_Owner.TopDockSite,false).Height;
							r.Height-=GetSiteZOrderSize(m_Owner.BottomDockSite,false).Height;
							pDockInfo.DockSiteZOrderIndex=partialSizeIndex;
							
						}
						r.Width=bar.GetBarDockedSize(eOrientation.Vertical);
						
						Point p=Point.Empty;
						if(pDockInfo.DockLine==-1)
						{
							p=this.PointToScreen(new Point(this.ClientRectangle.X,this.ClientRectangle.Y));
						}
						else
						{
							p=this.PointToScreen(new Point(this.ClientRectangle.Right,this.ClientRectangle.Y));
							p.X++;
						}
						if(fullSizeIndex>=0)
							p.Y-=GetSiteZOrderSize(m_Owner.TopDockSite,true).Height;
						else if(partialSizeIndex>=0)
							p.Y+=GetSiteZOrderSize(m_Owner.TopDockSite,false).Height;
						r.Location=p;
						break;
					}
				}
			}
			else
			{
				Bar barInsertPos=null;
				if(pDockInfo.InsertPosition>=0 && pDockInfo.InsertPosition<this.Controls.Count)
				{
					barInsertPos=this.Controls[pDockInfo.InsertPosition] as Bar;
					if(!pDockInfo.NewLine)
					{
						// Docking on the same line the DockLine should match
						if(barInsertPos.DockLine>pDockInfo.DockLine)
						{
							int ipos=pDockInfo.InsertPosition-1;
							while(ipos>=0)
							{
								Bar b=this.Controls[ipos] as Bar;
								if(b!=null && b.LayoutType==eLayoutType.DockContainer && b.DockLine==pDockInfo.DockLine)
								{
									barInsertPos=b;
									break;
								}
							}
						}
						else if(barInsertPos.DockLine<pDockInfo.DockLine)
						{
							int ipos=pDockInfo.InsertPosition+1;
							while(ipos<this.Controls.Count)
							{
								Bar b=this.Controls[ipos] as Bar;
								if(b!=null && b.LayoutType==eLayoutType.DockContainer && b.DockLine==pDockInfo.DockLine)
								{
									barInsertPos=b;
									break;
								}
							}
						}
					}
				}
				else if(pDockInfo.InsertPosition<0)
					barInsertPos=this.Controls[0] as Bar;
				else if(pDockInfo.InsertPosition>=this.Controls.Count)
					barInsertPos=this.Controls[this.Controls.Count-1] as Bar;

				int i=pDockInfo.InsertPosition+1;
				while(i<this.Controls.Count && (bar==null || barInsertPos.LayoutType!=eLayoutType.DockContainer || !barInsertPos.Visible))
				{
					barInsertPos=this.Controls[i] as Bar;
					i++;
				}

				if(barInsertPos==null)
					return r;

				// Docks the bar to the edge
				switch(this.Dock)
				{
					case DockStyle.Top:
					case DockStyle.Bottom:
					{
						r.Height=bar.GetBarDockedSize(eOrientation.Horizontal);
						if(pDockInfo.NewLine || barInsertPos==bar)
						{
							r.Width=barInsertPos.Width;
							if(r.Width==0)
								r.Width=this.Width;
							Point p=this.PointToScreen(new Point(barInsertPos.Left,barInsertPos.Top));
							r.Location=p;
						}
						else
						{
							if(barInsertPos.DockOffset>pDockInfo.DockOffset)
							{
								// Left half
								r.Height=barInsertPos.Height;
								r.Width=barInsertPos.Width/2;
								Point p=this.PointToScreen(new Point(barInsertPos.Left,barInsertPos.Top));
								r.Location=p;
							}
							else
							{
								// Split Right Half
								r.Height=barInsertPos.Height;
								r.Width=barInsertPos.Width/2;
								Point p=this.PointToScreen(new Point(barInsertPos.Left+r.Width,barInsertPos.Top));
								r.Location=p;
							}
						}
						break;
					}
					default: // Covers both Right and Left
					{
						r.Width=bar.GetBarDockedSize(eOrientation.Vertical);
						if(pDockInfo.NewLine || barInsertPos==bar)
						{
							r.Height=barInsertPos.Height;
							Point p=this.PointToScreen(new Point(barInsertPos.Left,barInsertPos.Top));
							r.Location=p;
						}
						else
						{
							if(barInsertPos.DockOffset<pDockInfo.DockOffset)
							{
								// Bottom half
								r.Width=barInsertPos.Width;
								r.Height=barInsertPos.Height/2;
								Point p=this.PointToScreen(new Point(barInsertPos.Left,barInsertPos.Top+r.Height));
								r.Location=p;
							}
							else
							{
								// Split Top Half
								r.Width=barInsertPos.Width;
								r.Height=barInsertPos.Height/2;
								Point p=this.PointToScreen(new Point(barInsertPos.Left,barInsertPos.Top));
								r.Location=p;
							}
						}
						break;
					}
				}
			}

			return r;
		}