示例#1
0
        protected void DrawString(SpriteFont font, string text, Rectangle bounds, AlignmentEnum align, Color color)
        {
            Vector2 size   = font.MeasureString(text);
            Point   pos    = bounds.Center;
            Vector2 origin = size * 0.5f;

            if (align.HasFlag(AlignmentEnum.Left))
            {
                origin.X += bounds.Width / 2 - size.X / 2;
            }

            if (align.HasFlag(AlignmentEnum.Right))
            {
                origin.X -= bounds.Width / 2 - size.X / 2;
            }

            if (align.HasFlag(AlignmentEnum.Top))
            {
                origin.Y += bounds.Height / 2 - size.Y / 2;
            }

            if (align.HasFlag(AlignmentEnum.Bottom))
            {
                origin.Y -= bounds.Height / 2 - size.Y / 2;
            }

            Engine.SpriteBatch.DrawString(font, text, new Vector2(pos.X, pos.Y), color, 0, origin, 1, SpriteEffects.None, 0);
        }
示例#2
0
 public ContentSetObj(Int32 col, Int32[] colindent, Boolean bycol, AlignmentEnum alignment)
 {
     Column   = col; ColIndent = colindent; ByColumn = bycol; Alignment = alignment;
     Row      = Count = Width = Height = 0;
     ColWidth = RowHeight = new Int32[1] {
         0
     };
     RowIndent = new Int32[1] {
         -1
     };
     Position = new Position(true);
 }
示例#3
0
 public ContentSetObj(Boolean init)
 {
     Column   = Row = Count = Width = Height = 0;
     ColWidth = RowHeight = new Int32[1] {
         0
     };
     ColIndent = RowIndent = new Int32[1] {
         -1
     };
     ByColumn = false; Alignment = AlignmentEnum.Center;
     Position = new Position(true);
 }
示例#4
0
        public void Write(BaseWidget widget, int col, AlignmentEnum align)
        {
            ClassicReportPageItem item = new ClassicReportPageItem(this);

            item.IsBold      = widget.IsBold;
            item.IsItalic    = widget.IsItalic;
            item.IsUnderline = widget.IsUnderline;
            item.Align       = align;
            item.Col         = col;
            item.Text        = widget.Value;
            _items.Add(item);
        }
示例#5
0
        protected string Alignment2CSS(AlignmentEnum alignment)
        {
            switch (alignment)
            {
            case AlignmentEnum.Left: return("text-align:left;");

            case AlignmentEnum.Right: return("text-align:right;");

            case AlignmentEnum.Center: return("text-align:center;");
            }
            return(string.Empty);
        }
示例#6
0
 public void Write(BaseWidget widget, int col, AlignmentEnum align)
 {
     ClassicReportPageItem item = new ClassicReportPageItem(this);
     item.IsBold = widget.IsBold;
     item.IsItalic = widget.IsItalic;
     item.IsUnderline = widget.IsUnderline;
     item.Align = align;
     item.Col= col;
     item.Text = widget.Value;
     _items.Add(item);
 }