Source/Ribbon/Office2007RibbonControlPainter.cs
(开头部分) 41KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Drawing;
using System.Text;
using System.Drawing.Drawing2D;
using System.Collections;
using System.Runtime.InteropServices;
namespace DevComponents.DotNetBar
{
internal class Office2007RibbonControlPainter : RibbonControlPainter, Rendering.IOffice2007Painter
{
private Rendering.Office2007ColorTable m_ColorTable = null; //new Rendering.Office2007ColorTable();
#region Ribbon Control Background
/// <summary>
/// Paints controls background
/// </summary>
public override void PaintBackground(RibbonControlRendererEventArgs e)
{
Graphics g = e.Graphics;
RibbonControl rc = e.RibbonControl;
Rendering.Office2007RibbonColorTable ct = m_ColorTable.RibbonControl;
Rendering.Office2007RibbonTabItemStateColorTable selectedTabColors = null;
PaintCaptionBackground(e, rc.DisplayRectangle);
if (rc.Expanded && rc.RibbonStrip.HasVisibleTabs)
{
int cornerSize = ct.CornerSize;
// Draw the border which is base for the tabs
Rectangle selectedTabRect = Rectangle.Empty;
if (rc.SelectedRibbonTabItem == null || !rc.Expanded)
selectedTabRect = Rectangle.Empty;
else
{
selectedTabRect = rc.SelectedRibbonTabItem.DisplayRectangle;
selectedTabColors = Office2007RibbonTabItemPainter.GetStateColorTable(Office2007RibbonTabItemPainter.GetColorTable(this.ColorTable, rc.SelectedRibbonTabItem), rc.SelectedRibbonTabItem, rc.Expanded);
}
Rectangle bottomBounds = new Rectangle(rc.ClientRectangle.X, rc.ClientRectangle.Bottom - cornerSize, rc.ClientRectangle.Width - 1, cornerSize);
if (!selectedTabRect.IsEmpty)
bottomBounds = new Rectangle(rc.ClientRectangle.X, selectedTabRect.Bottom,
rc.ClientRectangle.Width - 1, rc.ClientRectangle.Bottom - selectedTabRect.Bottom);
using (GraphicsPath path = GetBottomLinePath(bottomBounds, cornerSize))
{
using (SolidBrush brush = new SolidBrush(m_ColorTable.RibbonBar.Default.TopBackground.Start))
g.FillPath(brush, path);
}
// Dark border
using (GraphicsPath path = GetBottomLinePath(bottomBounds, cornerSize))
{
Region oldRegion = null;
if (g.Clip != null) oldRegion = g.Clip.Clone() as Region;
if (!selectedTabRect.IsEmpty)
{
if (selectedTabColors != null)
{
后面还有 838 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。