/// <summary> /// Paints the Ribbon on the specified device /// </summary> /// <param name="g">Device where to paint on</param> /// <param name="clip">Clip rectangle</param> private void PaintOn(Graphics g, Rectangle clip) { if (WinApi.IsWindows && Environment.OSVersion.Platform == PlatformID.Win32NT) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; } //Caption Background Renderer.OnRenderRibbonBackground(new RibbonRenderEventArgs(this, g, clip)); //Caption Bar Renderer.OnRenderRibbonCaptionBar(new RibbonRenderEventArgs(this, g, clip)); //Caption Buttons if (CaptionButtonsVisible) { MinimizeButton.OnPaint(this, new RibbonElementPaintEventArgs(clip, g, RibbonElementSizeMode.Medium)); MaximizeRestoreButton.OnPaint(this, new RibbonElementPaintEventArgs(clip, g, RibbonElementSizeMode.Medium)); CloseButton.OnPaint(this, new RibbonElementPaintEventArgs(clip, g, RibbonElementSizeMode.Medium)); } //Orb Renderer.OnRenderRibbonOrb(new RibbonRenderEventArgs(this, g, clip)); //QuickAcess toolbar QuickAcessToolbar.OnPaint(this, new RibbonElementPaintEventArgs(clip, g, RibbonElementSizeMode.Compact)); //Render Tabs foreach (RibbonTab tab in Tabs) { tab.OnPaint(this, new RibbonElementPaintEventArgs(tab.TabBounds, g, RibbonElementSizeMode.None, this)); } }
/// <summary> /// Overriden. Raises the Paint event and draws all the Ribbon content /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> that contains the event data.</param> protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { if (_updatingSuspended) { return; } if (Size != _lastSizeMeasured) { UpdateRegions(e.Graphics); } e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; Renderer.OnRenderRibbonBackground(new RibbonRenderEventArgs(this, e.Graphics, e.ClipRectangle)); //Caption Bar if (QuickAccessVisible) { Renderer.OnRenderRibbonCaptionBar(new RibbonRenderEventArgs(this, e.Graphics, e.ClipRectangle)); } //Orb Renderer.OnRenderRibbonOrb(new RibbonRenderEventArgs(this, e.Graphics, e.ClipRectangle)); //QuickAcess toolbar if (QuickAccessVisible) { QuickAcessToolbar.OnPaint(this, new RibbonElementPaintEventArgs(e.ClipRectangle, e.Graphics, RibbonElementSizeMode.Compact)); } //Render Tabs foreach (RibbonTab tab in Tabs) { tab.OnPaint(this, new RibbonElementPaintEventArgs(tab.TabBounds, e.Graphics, RibbonElementSizeMode.None)); } }