Source/Ribbon/Office2007RibbonTabItemPainter.cs
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using DevComponents.DotNetBar.Rendering;
namespace DevComponents.DotNetBar
{
/// <summary>
/// RibbonTabItem painter for Office 2007 style
/// </summary>
internal class Office2007RibbonTabItemPainter : Office2007ButtonItemPainter
{
protected override Rectangle GetTextRectangle(ButtonItem button, ItemPaintArgs pa, eTextFormat stringFormat, CompositeImage image)
{
Rectangle r = base.GetTextRectangle(button, pa, stringFormat, image);
if(image==null)
r.Inflate(-3, 0);
return r;
}
public override eTextFormat GetStringFormat(ButtonItem button, ItemPaintArgs pa, CompositeImage image)
{
eTextFormat sf = base.GetStringFormat(button, pa, image);
sf &= ~(sf & eTextFormat.EndEllipsis);
return sf;
}
protected override void PaintState(ButtonItem button, ItemPaintArgs pa, CompositeImage image, Rectangle r, bool isMouseDown)
{
if (r.IsEmpty || !IsItemEnabled(button, pa) || r.Width==0 || r.Height==0)
return;
RibbonTabItem tab = button as RibbonTabItem;
if (tab == null || IsOnMenu(button, pa))
{
base.PaintState(button, pa, image, r, isMouseDown);
return;
}
bool isOnMenu = pa.IsOnMenu;
Office2007RibbonTabItemColorTable tabColorTable = GetColorTable(tab);
if (tabColorTable == null)
return;
bool ribbonExpanded = pa.ControlExpanded;
Office2007RibbonTabItemStateColorTable stateColors = GetStateColorTable(tabColorTable, tab, ribbonExpanded);
if (stateColors == null)
return;
Graphics g = pa.Graphics;
int cornerSize = tabColorTable.CornerSize;
Region oldClip = g.Clip;
Rectangle rClip = r;
rClip.Inflate(1, 1);
g.SetClip(rClip, CombineMode.Replace);
if (stateColors != null)
{
后面还有 174 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。