Source/TextMarkup/FontElement.cs

(开头部分) 5KB

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

using System;
using System.Text;
using System.Drawing;
using System.Xml;

#if AdvTree
using DevComponents.Tree;
namespace DevComponents.Tree.TextMarkup
#elif DOTNETBAR
namespace DevComponents.DotNetBar.TextMarkup
#endif
{
    internal class FontElement : FontChangeElement
    {
        #region Private Variables
        private Color m_ForeColor = Color.Empty;
        private Color m_OldForeColor = Color.Empty;
        private int m_Size = 0;
        private bool m_RelativeSize = false;
        private string m_Face = "";
        private string m_SystemColorName = "";
        #endregion

        #region Internal Implementation
        protected override void SetFont(MarkupDrawContext d)
        {
            Font font = d.CurrentFont;
            try
            {
                if (m_Face != "" || m_Size != 0 && m_RelativeSize || m_Size>4 && !m_RelativeSize)
                {
                    if (m_Face != "")
                        d.CurrentFont = new Font(m_Face, ((m_RelativeSize || m_Size == 0)?font.SizeInPoints + m_Size:m_Size), font.Style);
                    else
                        d.CurrentFont = new Font(font.FontFamily, ((m_RelativeSize || m_Size == 0)? font.SizeInPoints + m_Size : m_Size), font.Style);
                }
                else
                    font = null;
            }
            catch
            {
                font = null;
            }

            if (font != null)
                m_OldFont = font;

            if (!d.IgnoreFormattingColors)
            {
                if (!m_ForeColor.IsEmpty)
                {
                    m_OldForeColor = d.CurrentForeColor;
                    d.CurrentForeColor = m_ForeColor;
                }
                else if (m_SystemColorName != "")
                {
#if DOTNETBAR
                    if (Rendering.GlobalManager.Renderer is Rendering.Office2007Renderer)
                    {
                        m_OldForeColor = d.CurrentForeColor;
后面还有 122 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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