예제 #1
0
        /// <summary>
        /// 将显示行(实意)转换成Sub集合
        /// </summary>
        /// <returns>行(文本)</returns>
        public Sub[] ToSubs()
        {
            List <Sub> subs = new List <Sub>();

            if (Bold)
            {
                subs.Add(new Sub("Bold", ""));
            }

            if (Italic)
            {
                subs.Add(new Sub("Italic", ""));
            }

            if (Underline)
            {
                subs.Add(new Sub("Underline", ""));
            }

            if (Strikethrough)
            {
                subs.Add(new Sub("Deleteline", ""));
            }

            subs.Add(new Sub("FontSize", FontSize.ToString("f2")));
            subs.Add(new Sub("FontFamily", FontFamily.ToString()));
            subs.Add(new Sub("BackColor", LptDocument.ColorToHEX(BackColor)));
            subs.Add(new Sub("FontColor", LptDocument.ColorToHEX(FontColor)));
            switch (Alignment)
            {
            case TextAlignment.Left:
                subs.Add(new Sub("Left", "")); break;

            case TextAlignment.Right:
                subs.Add(new Sub("Right", "")); break;

            case TextAlignment.Center:
                subs.Add(new Sub("Center", "")); break;

            case TextAlignment.Justify:
                subs.Add(new Sub("Justify", "")); break;
            }
            return(subs.ToArray());
        }
예제 #2
0
        /// <summary>
        /// 将显示行(实意)转换成Sub集合
        /// </summary>
        /// <param name="OA">全局变量</param>
        /// <returns>行(文本)</returns>
        public Sub[] ToSubs(LineDisplay OA)
        {
            List <Sub> subs = new List <Sub>();

            if (OA.Bold != Bold)
            {
                if (Bold)
                {
                    subs.Add(new Sub("Bold", ""));
                }
            }
            if (OA.Italic != Italic)
            {
                if (Italic)
                {
                    subs.Add(new Sub("Italic", ""));
                }
            }
            if (OA.Underline != Underline)
            {
                if (Underline)
                {
                    subs.Add(new Sub("Underline", ""));
                }
            }
            if (OA.Strikethrough != Strikethrough)
            {
                if (Strikethrough)
                {
                    subs.Add(new Sub("Deleteline", ""));
                }
            }

            if (OA.FontSize.ToString("f1") != FontSize.ToString("f1"))
            {
                subs.Add(new Sub("FontSize", FontSize.ToString("f2")));
            }
            if (OA.FontFamily != FontFamily)
            {
                subs.Add(new Sub("FontFamily", FontFamily.ToString()));
            }
            if (OA.BackColor != BackColor)
            {
                subs.Add(new Sub("BackColor", LptDocument.ColorToHEX(BackColor)));
            }
            if (OA.FontColor != FontColor)
            {
                subs.Add(new Sub("FontColor", LptDocument.ColorToHEX(FontColor)));
            }
            if (OA.Alignment != Alignment)
            {
                switch (Alignment)
                {
                case TextAlignment.Left:
                    subs.Add(new Sub("Left", "")); break;

                case TextAlignment.Right:
                    subs.Add(new Sub("Right", "")); break;

                case TextAlignment.Center:
                    subs.Add(new Sub("Center", "")); break;

                case TextAlignment.Justify:
                    subs.Add(new Sub("Justify", "")); break;
                }
            }
            return(subs.ToArray());
        }