예제 #1
0
		protected override void OnMouseDragBegin(int x, int y)
		{
			DockSite site=this.Control as DockSite;
			if(this.Control.Dock==DockStyle.Fill && site!=null)
			{
				DocumentDockUIManager m=site.GetDocumentUIManager();
				Point pClient=site.PointToClient(new Point(x,y));
				Cursor c=m.GetCursor(pClient.X,pClient.Y);
				if(c!=null)
				{
					m.OnMouseDown(new MouseEventArgs(MouseButtons.Left,0,pClient.X,pClient.Y,0));
					m_MouseDrag=true;
				}
			}

			base.OnMouseDragBegin(x,y);

			if(m_MouseDrag)
			{
				site.Capture = true;
				NativeFunctions.RECT rect = new NativeFunctions.RECT(0,0,0,0);
				NativeFunctions.GetWindowRect(site.Handle, ref rect);
				Rectangle r=Rectangle.FromLTRB(rect.Left, rect.Top, rect.Right, rect.Bottom);
				Cursor.Clip=r;
			}
		}
예제 #2
0
 public override void Refresh()
 {
     base.Refresh();
     System.Drawing.Rectangle inv = m_Rect;
     Control c = this.ContainerControl as Control;
     if (c != null && IsHandleValid(c))
     {
         const int RDW_INVALIDATE = 0x0001;
         const int RDW_FRAME = 0x0400;
         int height = SystemInformation.Border3DSize.Height + SystemInformation.CaptionHeight;
         NativeFunctions.RECT r = new NativeFunctions.RECT(0, -height, c.Width, height);
         NativeFunctions.RedrawWindow(c.Handle, ref r, IntPtr.Zero, RDW_INVALIDATE | RDW_FRAME);
     }
 }
예제 #3
0
		protected override void OnMouseDragBegin(int x, int y)
		{
			Bar bar=this.Control as Bar;
			m_DragDrop=false;

			if(bar!=null && this.IsDockableWindow)
			{
				m_MouseDownSelectedTabIndex=GetTabAt(x,y);
				if(m_MouseDownSelectedTabIndex!=-1)
				{
					if(bar.SelectedDockTab!=m_MouseDownSelectedTabIndex)
						SelectDockTab(m_MouseDownSelectedTabIndex);
					m_DragDrop=true;
				}
				else if(IsInTabSystemBox(x,y))
				{
					MouseDownTabSystemBox(x,y);
				}
				else if(IsCaptionGrabHandle(bar))
				{
					Point clientPos=bar.PointToClient(new Point(x,y));
					if(bar.GrabHandleRect.Contains(clientPos))
						m_DragDrop=true;
				}
			}
			base.OnMouseDragBegin(x,y);
			
			if(m_MouseDownSelectedTabIndex!=-1)
			{
				ISelectionService selection = (ISelectionService) this.GetService(typeof(ISelectionService));
				if(selection!=null && selection.PrimarySelection!=bar.Items[m_MouseDownSelectedTabIndex])
				{
					ArrayList arr=new ArrayList(1);
					arr.Add(bar.Items[m_MouseDownSelectedTabIndex]);
#if FRAMEWORK20
                    selection.SetSelectedComponents(arr, SelectionTypes.Primary);
#else
                    selection.SetSelectedComponents(arr,SelectionTypes.Click);
#endif
                }
			}

			if(m_DragDrop)
			{
				bar.Capture = true;
				NativeFunctions.RECT rect = new NativeFunctions.RECT(0,0,0,0);
				NativeFunctions.GetWindowRect(bar.Parent.Handle, ref rect);
				Rectangle r=Rectangle.FromLTRB(rect.Left, rect.Top, rect.Right, rect.Bottom);
				Cursor.Clip=r;
			}
		}
예제 #4
0
 /// <summary>
 /// Invalidates non client area of the form.
 /// </summary>
 /// <param name="invalidateForm">Indicates whether complete form is invalidated.</param>
 public void InvalidateNonClient(bool invalidateForm)
 {
     if (!BarFunctions.IsHandleValid(this)) return;
     const int RDW_INVALIDATE = 0x0001;
     const int RDW_FRAME = 0x0400;
     NativeFunctions.RECT r = new NativeFunctions.RECT(0, 0, this.Width, m_Caption.HeightInternal);
     if(invalidateForm)
         r = new NativeFunctions.RECT(0, 0, this.Width, this.Height);
     NativeFunctions.RedrawWindow(this.Handle, ref r, IntPtr.Zero, RDW_INVALIDATE | RDW_FRAME);
 }
예제 #5
0
		protected override void OnMouseDragBegin(int x, int y)
		{
			Control bar=this.GetItemContainerControl();
			System.Windows.Forms.Control ctrl=this.GetItemContainerControl();
			
			BaseItem container=this.GetItemContainer();
			Point pos=ctrl.PointToClient(new Point(x,y));
			MouseEventArgs e=new MouseEventArgs(MouseButtons.Left,0,pos.X,pos.Y,0);
			
			BaseItem dragItem=null;
			container.InternalMouseDown(e);
			dragItem=((IOwner)ctrl).GetFocusItem();
			
			if(dragItem!=null)
			{
				ISelectionService selection = (ISelectionService) this.GetService(typeof(ISelectionService));
				if(selection!=null)
				{
					ArrayList arr=new ArrayList(1);
					arr.Add(dragItem);
#if FRAMEWORK20
                    selection.SetSelectedComponents(arr, SelectionTypes.Primary);
#else
                    selection.SetSelectedComponents(arr,SelectionTypes.MouseDown);
#endif
                    OnItemSelected(((IOwner)ctrl).GetFocusItem());
				}
			}

			if(bar==null || dragItem==null || this.IsDockableWindow || !m_EnableItemDragDrop || !CanDragItem(dragItem))
			{
				if(dragItem==null)
					base.OnMouseDragBegin(x,y);
				else
					this.Control.Capture = true; // Does same as base implementation
				return;
			}

			bar.Capture = true;
			NativeFunctions.RECT rect = new NativeFunctions.RECT(0,0,0,0);
			NativeFunctions.GetWindowRect(bar.Handle, ref rect);
			Rectangle r=Rectangle.FromLTRB(rect.Left, rect.Top, rect.Right, rect.Bottom);
			Cursor.Clip=r;
			StartItemDrag(dragItem);

			// Does same as base implementation
			this.Control.Capture = true;
		}
예제 #6
0
        protected void PaintDotNet(PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            SmoothingMode sm = g.SmoothingMode;
            TextRenderingHint th = g.TextRenderingHint;
            RenderBarEventArgs re = null;

            if (m_AntiAlias)
            {
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                g.TextRenderingHint = DisplayHelp.AntiAliasTextRenderingHint;
            }

            m_SystemButtons.CustomizeButtonRect = Rectangle.Empty;
            m_SystemButtons.CloseButtonRect = Rectangle.Empty;
            m_SystemButtons.AutoHideButtonRect = Rectangle.Empty;
            m_SystemButtons.CaptionButtonRect = Rectangle.Empty;
            ColorScheme cs = this.GetColorScheme();

            ItemPaintArgs pa = GetItemPaintArgs(g);
            pa.ClipRectangle = e.ClipRectangle;
            Pen p;
            if (m_BarState == eBarState.Popup)
                p = new Pen(pa.Colors.BarPopupBorder, 1);
            else
                p = new Pen(pa.Colors.BarFloatingBorder);

            if (this.DisplayShadow && !this.AlphaShadow && m_ParentItem != null && !BarFunctions.IsOffice2007Style(m_ParentItem.EffectiveStyle))
                SetupRegion();

            if (m_BarState == eBarState.Popup)
            {
                re = new RenderBarEventArgs(this, g, eBarRenderPart.Background, this.ClientRectangle);
                OnPreRender(re);
                if (!re.Cancel)
                {
                    if (m_ParentItem != null && BarFunctions.IsOffice2007Style(m_ParentItem.EffectiveStyle) && GetRenderer() != null)
                    {
                        ToolbarRendererEventArgs tre = new ToolbarRendererEventArgs(this, g, this.DisplayRectangle);
                        tre.ItemPaintArgs = pa;
                        GetRenderer().DrawPopupToolbarBackground(tre);
                    }
                    else
                    {
                        using (SolidBrush brush = new SolidBrush(pa.Colors.BarPopupBackground))
                            g.FillRectangle(brush, this.DisplayRectangle);
                        PaintBackgroundImage(pa.Graphics);

                        PaintSideBar(g);

                        Rectangle borderRectangle = this.ClientRectangle;
                        if (this.DisplayShadow && !this.AlphaShadow)
                            borderRectangle = new Rectangle(0, 0, this.ClientSize.Width - 2, this.ClientSize.Height - 2);

                        if (m_ParentItem != null && BarFunctions.IsOffice2007Style(m_ParentItem.EffectiveStyle))
                            DisplayHelp.DrawRoundedRectangle(g, p, borderRectangle, m_CornerSize);
                        else
                            NativeFunctions.DrawRectangle(g, p, borderRectangle);

                        if (this.DisplayShadow && !this.AlphaShadow)
                        {
                            // Shadow
                            p.Dispose();
                            p = new Pen(SystemColors.ControlDark, 2);
                            Point[] pt = new Point[3];
                            pt[0].X = 2;
                            pt[0].Y = this.ClientSize.Height - 1;
                            pt[1].X = this.ClientSize.Width - 1;
                            pt[1].Y = this.ClientSize.Height - 1;
                            pt[2].X = this.ClientSize.Width - 1;
                            pt[2].Y = 2;
                            g.DrawLines(p, pt);
                        }
                        if (m_ParentItem != null && !BarFunctions.IsOffice2007Style(m_ParentItem.EffectiveStyle) && m_ParentItem is ButtonItem && m_ParentItem.Displayed)
                        {
                            // Determine where to draw the line based on parent position
                            if (m_ParentItemScreenPos.Y < this.Location.Y)
                            {
                                Point p1 = new Point((m_ParentItemScreenPos.X - this.Location.X) + 1, 0);
                                Point p2 = new Point(p1.X + m_ParentItem.WidthInternal - 5, 0);
                                DisplayHelp.DrawLine(g, p1, p2, pa.Colors.ItemExpandedBackground, 1);
                                //g.DrawLine(new Pen(pa.Colors.ItemExpandedBackground, 1), p1, p2);
                            }
                        }
                    }
                }
            }
            else if (m_BarState == eBarState.Floating)
            {
                bool drawCaptionText = true;

                re = new RenderBarEventArgs(this, g, eBarRenderPart.Background, this.ClientRectangle);
                OnPreRender(re);
                if (!re.Cancel)
                {
                    if (BarFunctions.IsOffice2007Style(this.Style) && this.GetRenderer() != null)
                    {
                        ToolbarRendererEventArgs tre = new ToolbarRendererEventArgs(this, g, this.DisplayRectangle);
                        tre.ItemPaintArgs = pa;
                        this.GetRenderer().DrawToolbarBackground(tre);
                    }
                    else
                    {
                        sm = g.SmoothingMode;
                        g.SmoothingMode = SmoothingMode.Default;
                        if (this.MenuBar)
                            DisplayHelp.FillRectangle(g, this.ClientRectangle, pa.Colors.MenuBarBackground, pa.Colors.MenuBarBackground2, pa.Colors.MenuBarBackgroundGradientAngle);
                        else
                            DisplayHelp.FillRectangle(g, this.ClientRectangle, pa.Colors.BarBackground, pa.Colors.BarBackground2, pa.Colors.BarBackgroundGradientAngle);

                        PaintBackgroundImage(pa.Graphics);
                        g.SmoothingMode = sm;
                    }
                }

                Rectangle r = new Rectangle(0, 0, this.Width, this.Height);

                ThemeWindow theme = null;
                ThemeWindowParts part = ThemeWindowParts.SmallFrameLeft;
                ThemeWindowStates state = ThemeWindowStates.FrameActive;

                re = new RenderBarEventArgs(this, g, eBarRenderPart.Caption, Rectangle.Empty);

                if (this.DrawThemedCaption)
                {
                    re.Bounds = new Rectangle(0, 0, this.Width, m_ThemeWindowMargins.Top + 1);
                    OnPreRender(re);
                    if (!re.Cancel)
                    {
                        theme = this.ThemeWindow;
                        if (this.LayoutType == eLayoutType.DockContainer && !m_HasFocus)
                            state = ThemeWindowStates.FrameInactive;

                        theme.DrawBackground(g, part, state, new Rectangle(0, 0, m_ThemeWindowMargins.Left, this.Height));
                        part = ThemeWindowParts.SmallFrameRight;
                        theme.DrawBackground(g, part, state, new Rectangle(this.Width - m_ThemeWindowMargins.Right, 0, m_ThemeWindowMargins.Left, this.Height));
                        part = ThemeWindowParts.SmallFrameBottom;
                        theme.DrawBackground(g, part, state, new Rectangle(0, this.Height - m_ThemeWindowMargins.Bottom, this.Width, m_ThemeWindowMargins.Bottom));

                        if (this.LayoutType == eLayoutType.DockContainer && !m_HasFocus)
                            state = ThemeWindowStates.CaptionInactive;
                        part = ThemeWindowParts.SmallCaption;
                    }
                    r = new Rectangle(0, 0, this.Width, m_ThemeWindowMargins.Top + 1);
                    theme.DrawBackground(g, part, state, r);
                    r.Offset(0, 1);
                }
                else if (m_GrabHandleStyle == eGrabHandleStyle.Caption && this.LayoutType == eLayoutType.DockContainer && this.Style == eDotNetBarStyle.Office2000)
                {
                    Rectangle rback = new Rectangle(3, 3, this.Width - 6, GetGrabHandleCaptionHeight());
                    re.Bounds = rback;
                    OnPreRender(re);
                    if (!re.Cancel)
                    {
                        ControlPaint.DrawBorder3D(g, r, Border3DStyle.Raised, Border3DSide.All);
                        eDrawCaption flags = eDrawCaption.DC_SMALLCAP | eDrawCaption.DC_GRADIENT | eDrawCaption.DC_TEXT;
                        if (m_HasFocus) flags |= eDrawCaption.DC_ACTIVE;
                        IntPtr hdc = g.GetHdc();
                        NativeFunctions.RECT rect = new NativeFunctions.RECT(rback.X, rback.Y, rback.Right, rback.Bottom);
                        try
                        {
                            NativeFunctions.DrawCaption(this.Handle, hdc, ref rect, flags);
                        }
                        finally
                        {
                            g.ReleaseHdc(hdc);
                        }
                    }
                    drawCaptionText = false;
                    r = rback;
                }
                else
                {
                    Rectangle rback = new Rectangle(3, 3, this.Width - 6, GetGrabHandleCaptionHeight());
                    re.Bounds = rback;
                    OnPreRender(re);

                    if (!re.Cancel)
                    {
                        Pen p1 = new Pen(pa.Colors.BarFloatingBorder, 1);
                        NativeFunctions.DrawRectangle(g, p, r);
                        r.Inflate(-1, -1);
                        NativeFunctions.DrawRectangle(g, p, r);

                        p1.Dispose();
                        p1 = new Pen(pa.Colors.BarFloatingBorder, 1);
                        g.DrawLine(p1, 1, 2, 2, 2);
                        g.DrawLine(p1, this.Width - 3, 2, this.Width - 2, 2);
                        g.DrawLine(p1, 1, this.Height - 3, 2, this.Height - 3);
                        g.DrawLine(p1, this.Width - 3, this.Height - 3, this.Width - 2, this.Height - 3);
                        p1.Dispose();
                        p1 = null;

                        if (this.GrabHandleStyle != eGrabHandleStyle.CaptionTaskPane)
                        {
                            sm = g.SmoothingMode;
                            g.SmoothingMode = SmoothingMode.Default;

                            if (m_CaptionBackColor.IsEmpty)
                            {
                                if (this.LayoutType == eLayoutType.Toolbar || m_HasFocus)
                                    DisplayHelp.FillRectangle(g, rback, pa.Colors.BarCaptionBackground, pa.Colors.BarCaptionBackground2, pa.Colors.BarCaptionBackgroundGradientAngle);
                                else
                                    DisplayHelp.FillRectangle(g, rback, pa.Colors.BarCaptionInactiveBackground, pa.Colors.BarCaptionInactiveBackground2, pa.Colors.BarCaptionInactiveBackgroundGAngle);
                            }
                            else
                                DisplayHelp.FillRectangle(g, new Rectangle(3, 3, this.Width - 6, GetGrabHandleCaptionHeight()), m_CaptionBackColor, Color.Empty);

                            g.SmoothingMode = sm;
                        }
                    }
                    r = rback;
                }

                r.Inflate(-1, -1);

                if (this.GrabHandleStyle != eGrabHandleStyle.CaptionTaskPane)
                {
                    if (this.CanHideResolved)
                    {
                        m_SystemButtons.CloseButtonRect = new Rectangle(r.Right - (m_SystemButtons.ButtonSize.Width + 3), r.Y + (r.Height - m_SystemButtons.ButtonSize.Height) / 2, m_SystemButtons.ButtonSize.Width, m_SystemButtons.ButtonSize.Height);
                        re = new RenderBarEventArgs(this, g, eBarRenderPart.CloseButton, m_SystemButtons.CloseButtonRect);
                        OnPreRender(re);
                        m_SystemButtons.CloseButtonRect = re.Bounds;
                        r.Width -= (m_SystemButtons.CloseButtonRect.Width + 3);
                        if (!re.Cancel)
                            PaintCloseButton(pa);
                    }
                    if (this.ShowCustomizeMenuButton)
                    {
                        m_SystemButtons.CustomizeButtonRect = new Rectangle(r.Right - (m_SystemButtons.ButtonSize.Width + 1), r.Y + (r.Height - m_SystemButtons.ButtonSize.Height) / 2, m_SystemButtons.ButtonSize.Width, m_SystemButtons.ButtonSize.Height);
                        re = new RenderBarEventArgs(this, g, eBarRenderPart.CustomizeButton, m_SystemButtons.CustomizeButtonRect);
                        OnPreRender(re);
                        m_SystemButtons.CustomizeButtonRect = re.Bounds;
                        r.Width -= (m_SystemButtons.CustomizeButtonRect.Width + 2);
                        if (!re.Cancel)
                            PaintCustomizeButton(pa);
                    }
                    r.X += 2;
                    r.Width -= 2;
                    if (r.Width > 0 && drawCaptionText)
                    {
                        re = new RenderBarEventArgs(this, g, eBarRenderPart.CaptionText, r);
                        OnPreRender(re);
                        if (!re.Cancel)
                        {
                            System.Drawing.Font objFont = null;
                            try
                            {
                                objFont = new Font(this.Font, FontStyle.Bold);
                            }
                            catch
                            {
                                objFont = SystemFonts.MenuFont; // (Font)System.Windows.Forms.SystemInformation.MenuFont.Clone();
                            }
                            eTextFormat sf = eTextFormat.Default | eTextFormat.EndEllipsis | eTextFormat.SingleLine | eTextFormat.VerticalCenter;
                            if (m_CaptionForeColor.IsEmpty)
                            {
                                if (this.DrawThemedCaption)
                                {
                                    if (m_HasFocus)
                                        state = ThemeWindowStates.CaptionActive;
                                    else
                                        state = ThemeWindowStates.CaptionInactive;
                                    r.Y += 1;
                                    //theme.DrawText(g, this.Text, objFont, r, part, state, ThemeTextFormat.Left | ThemeTextFormat.VCenter);
                                }
                                //else
                                TextDrawing.DrawString(g, this.Text, objFont, ((m_HasFocus || this.LayoutType == eLayoutType.Toolbar) ? pa.Colors.BarCaptionText : pa.Colors.BarCaptionInactiveText), r, sf);
                            }
                            else
                                TextDrawing.DrawString(g, this.Text, objFont, m_CaptionForeColor, r, sf);
                            objFont.Dispose();
                            objFont = null;
                        }
                    }
                }
                else
                {
                    this.PaintGrabHandle(pa);
                }
            }
            else if (m_BarState == eBarState.Docked && BarFunctions.IsOffice2007Style(this.Style) && this.GetRenderer() != null && (!this.IsThemed || this.MenuBar))
            {
                re = new RenderBarEventArgs(this, g, eBarRenderPart.Background, this.DisplayRectangle);
                OnPreRender(re);
                if (!re.Cancel && this.BackColor != Color.Transparent)
                {
                    ToolbarRendererEventArgs tre = new ToolbarRendererEventArgs(this, g, this.DisplayRectangle);
                    tre.ItemPaintArgs = pa;
                    this.GetRenderer().DrawToolbarBackground(tre);
                }
                else
                    PaintGrabHandle(pa);
            }
            else
            {
                p.Dispose();
                p = null;
                bool drawBorder = true;
                // Docked state
                if (m_ItemContainer.m_BackgroundColor.IsEmpty && this.BackColor != Color.Transparent)
                {
                    if (this.IsThemed)
                    {
                        Rectangle r = new Rectangle(-this.Location.X, -this.Location.Y, this.Parent.Width, this.Parent.Height);
                        ThemeRebar theme = this.ThemeRebar;
                        theme.DrawBackground(g, ThemeRebarParts.Background, ThemeRebarStates.Normal, r);
                    }
                    else
                    {
                        sm = g.SmoothingMode;
                        g.SmoothingMode = SmoothingMode.Default;
                        re = new RenderBarEventArgs(this, g, eBarRenderPart.Background, this.ClientRectangle);
                        OnPreRender(re);
                        if (!re.Cancel)
                        {
                            if (this.MenuBar)
                            {
                                if (!pa.Colors.MenuBarBackground2.IsEmpty && pa.Colors.MenuBarBackground2.A > 0)
                                {
                                    System.Drawing.Drawing2D.LinearGradientBrush gradient = BarFunctions.CreateLinearGradientBrush(this.ClientRectangle, pa.Colors.MenuBarBackground, pa.Colors.MenuBarBackground2, pa.Colors.MenuBarBackgroundGradientAngle);
                                    g.FillRectangle(gradient, this.ClientRectangle);
                                    gradient.Dispose();
                                }
                                else if (IsGradientStyle && this.Parent != null && !pa.Colors.DockSiteBackColor2.IsEmpty && !pa.Colors.DockSiteBackColor.IsEmpty)
                                {
                                    System.Drawing.Drawing2D.LinearGradientBrush gradient = BarFunctions.CreateLinearGradientBrush(new Rectangle(-this.Left, -this.Top, this.Parent.Width, this.Parent.Height), pa.Colors.DockSiteBackColor, pa.Colors.DockSiteBackColor2, 0f);
                                    g.FillRectangle(gradient, -this.Left, -this.Top, this.Parent.Width, this.Parent.Height);
                                    gradient.Dispose();
                                }
                                else
                                {
                                    using (SolidBrush brush = new SolidBrush(pa.Colors.MenuBarBackground))
                                        g.FillRectangle(brush, this.DisplayRectangle);
                                }
                            }
                            else
                            {
                                if (this.Style == eDotNetBarStyle.VS2005 && this.LayoutType == eLayoutType.DockContainer && !this.BackColor.IsEmpty)
                                {
                                    DisplayHelp.FillRectangle(g, this.ClientRectangle, this.BackColor, Color.Empty);
                                }
                                else if (this.GradientBackground)
                                    DisplayHelp.FillRectangle(g, this.ClientRectangle, pa.Colors.BarBackground, pa.Colors.BarBackground2, pa.Colors.BarBackgroundGradientAngle);
                                else
                                {
                                    using (SolidBrush brush = new SolidBrush(pa.Colors.BarBackground))
                                        g.FillRectangle(brush, this.ClientRectangle);
                                }
                            }
                        }
                        else
                            drawBorder = false;
                        g.SmoothingMode = sm;
                    }
                }
                else if (!m_ItemContainer.BackColor.IsEmpty)
                {
                    sm = g.SmoothingMode;
                    g.SmoothingMode = SmoothingMode.Default;
                    re = new RenderBarEventArgs(this, g, eBarRenderPart.Background, this.DisplayRectangle);
                    OnPreRender(re);
                    if (!re.Cancel)
                    {
                        using (SolidBrush brush = new SolidBrush(m_ItemContainer.BackColor))
                            g.FillRectangle(brush, this.DisplayRectangle);
                    }
                    else
                        drawBorder = false;
                    g.SmoothingMode = sm;
                }

                if (this.Parent != null && this.Parent.BackgroundImage != null && this.Parent is DockSite)
                {
                    Rectangle r = new Rectangle(-this.Location.X, -this.Location.Y, this.Parent.Width, this.Parent.Height);
                    DockSite site = this.Parent as DockSite;
                    BarFunctions.PaintBackgroundImage(g, r, site.BackgroundImage, site.BackgroundImagePosition, site.BackgroundImageAlpha);
                }
                else
                    PaintBackgroundImage(pa.Graphics);

                if (drawBorder)
                {
                    if (IsGradientStyle && !this.IsThemed && this.LayoutType == eLayoutType.Toolbar && !this.MenuBar && this.BarType == eBarType.Toolbar && this.BackColor != Color.Transparent)
                    {
                        if (p != null) p.Dispose();
                        p = new Pen(pa.Colors.BarDockedBorder, 1);
                        g.DrawLine(p, 0, this.Height - 1, this.Width, this.Height - 1);
                        p.Dispose();
                        p = null;
                    }
                    else
                    {
                        Rectangle border = this.ClientRectangle;
                        border.Inflate(-2, -2);
                        BarFunctions.DrawBorder(g, m_DockedBorder, border, m_SingleLineColor);
                    }
                }
                PaintGrabHandle(pa);
            }
            m_ItemContainer.Paint(pa);
            if (m_BarType == eBarType.StatusBar && this.GrabHandleStyle == eGrabHandleStyle.ResizeHandle)
            {
                PaintGrabHandle(pa);
            }
            if (p != null) p.Dispose();
            g.SmoothingMode = sm;
            g.TextRenderingHint = th;

            if (HasPostRender)
            {
                re = new RenderBarEventArgs(this, g, eBarRenderPart.All, this.ClientRectangle);
                OnPostRender(re);
            }
        }