Source/Ribbon/Office2007RibbonTabGroupPainter.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Text;
using DevComponents.DotNetBar.Rendering;
using System.Drawing.Drawing2D;
using System.Drawing;
using System.Runtime.InteropServices;

namespace DevComponents.DotNetBar
{
    /// <summary>
    /// Represents the Office 2007 Ribbon Tab Group painter.
    /// </summary>
    internal class Office2007RibbonTabGroupPainter : RibbonTabGroupPainter, IOffice2007Painter
    {
        #region Private Variables
        private Office2007ColorTable m_ColorTable = null; //new Office2007ColorTable();
        #endregion

        #region Internal Implementation
        /// <summary>
        /// Paints ribbon tab group.
        /// </summary>
        /// <param name="e">Context information</param>
        public override void PaintTabGroup(RibbonTabGroupRendererEventArgs e)
        {
            Graphics g = e.Graphics;
            Office2007RibbonTabGroupColorTable colorTable = GetColors(e.RibbonTabItemGroup);
            if (colorTable == null)
                return;

            #if FRAMEWORK20
            if (e.ItemPaintArgs.GlassEnabled)
            {
                if (e.ItemPaintArgs.CachedPaint) return;
                PaintTabGroupBackground(g, colorTable, e.Bounds, e.GroupBounds, true);

                Rectangle rect = e.Bounds;
                rect.Height -= 2;
                IntPtr hdc = g.GetHdc();
                Font font = e.GroupFont;
                string text = e.RibbonTabItemGroup.GroupTitle;
                ThemeTextFormat tf = ThemeTextFormat.Center | ThemeTextFormat.EndEllipsis | ThemeTextFormat.VCenter | ThemeTextFormat.SingleLine;
                try
                {
                    IntPtr memdc = WinApi.CreateCompatibleDC(hdc);
                    try
                    {
                        WinApi.BITMAPINFO bmpInfo = new WinApi.BITMAPINFO();
                        bmpInfo.biWidth = rect.Width;
                        bmpInfo.biHeight = -rect.Height;
                        bmpInfo.biPlanes = 1;
                        bmpInfo.biBitCount = 32;
                        bmpInfo.biSize = Marshal.SizeOf(bmpInfo);
                        IntPtr dib = WinApi.CreateDIBSection(hdc, bmpInfo, 0, 0, IntPtr.Zero, 0);
                        WinApi.SelectObject(memdc, dib);

                        IntPtr fontHandle = font.ToHfont();
                        WinApi.SelectObject(memdc, fontHandle);

                        Themes.RECT bounds = new Themes.RECT(new Rectangle(0, 0, rect.Width, rect.Height));
后面还有 141 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。