示例#1
0
        public string[] ZheHang(string string_0)
        {
            Graphics graphics            = Graphics.FromImage(new Bitmap(100, 100));
            List <FontPrint.LineZH> list = new FontPrint(string_0, string.Empty, Aisino.Framework.Plugin.Core.Controls.PrintControl.DataType.String).ZheHang(base.Width - (2f * this._backgauge), this.FontSpacing, this.LineSpacing, this.font, graphics, this._LineLength);

            graphics.Dispose();
            List <string> list2 = new List <string>();

            foreach (FontPrint.LineZH ezh in list)
            {
                list2.Add(ezh.ToString());
            }
            return(list2.ToArray());
        }
示例#2
0
        protected override void Draw(PointF pointF_0, Graphics graphics_0, bool bool_0)
        {
            base.Draw(pointF_0, graphics_0, bool_0);
            if (base._isPrint)
            {
                RectangleF ef                = new RectangleF(new PointF(this.absoluteLocation.X + this._backgauge, this.absoluteLocation.Y), new SizeF(base.Width - (2f * this._backgauge), base.Height));
                Font       font              = this._font;
                FontPrint  print             = new FontPrint(this._PrintText, this._Format, this._dataType);
                List <FontPrint.LineZH> list = print.ZheHang(ef.Width, this._FontSpacing, this._LineSpacing, font, graphics_0, this.LineLength);
                float num = (list.Count * (font.Height + this._LineSpacing)) - this._LineSpacing;
                while (num > ef.Height)
                {
                    font = new Font(font.FontFamily, font.Size - 1f);
                    list = print.ZheHang(ef.Width, this._FontSpacing, this._LineSpacing, font, graphics_0, this.LineLength);
                    num  = (list.Count * (font.Height + this._LineSpacing)) - this._LineSpacing;
                    if (font.Size <= 5f)
                    {
                        break;
                    }
                }
                PointF empty = PointF.Empty;
                switch (this._VerticalAlign)
                {
                case VerticalType.Top:
                    empty.Y = 0f;
                    break;

                case VerticalType.Botton:
                    if (num <= ef.Height)
                    {
                        empty.Y = ef.Height - num;
                    }
                    break;

                case VerticalType.Center:
                    if (num <= ef.Height)
                    {
                        empty.Y = (ef.Height - num) / 2f;
                    }
                    break;
                }
                foreach (FontPrint.LineZH ezh in list)
                {
                    switch (this._HorizontalAlign)
                    {
                    case HorizontalType.Left:
                        empty.X = 0f;
                        break;

                    case HorizontalType.Right:
                        if (ezh.Width <= ef.Width)
                        {
                            empty.X = ef.Width - ezh.Width;
                        }
                        break;

                    case HorizontalType.Center:
                        if (ezh.Width <= ef.Width)
                        {
                            empty.X = (ef.Width - ezh.Width) / 2f;
                        }
                        break;
                    }
                    print.DrawString(ezh, this._FontSpacing, font, new SolidBrush(base._foreColor), graphics_0, new PointF(empty.X + ef.X, empty.Y + ef.Y), bool_0, base._ID);
                    empty.Y = (empty.Y + font.Height) + this._LineSpacing;
                    if (empty.Y < 0f)
                    {
                        empty.Y = 1f;
                    }
                    if ((empty.Y - this._LineSpacing) > ef.Height)
                    {
                        break;
                    }
                }
            }
        }