Пример #1
0
 /// <summary>
 /// Initializes a new LabelStyle
 /// </summary>
 public LabelStyle()
 {
     _Font = new System.Drawing.Font("Times New Roman", 12f);
     _Offset = new System.Drawing.PointF(0, 0);
     _CollisionDetection = false;
     _CollisionBuffer = new System.Drawing.Size(0, 0);
     _ForeColor = System.Drawing.Color.Black;
     _HorisontalAlignment = HorizontalAlignmentEnum.Center;
     _VerticalAlignment = VerticalAlignmentEnum.Middle;
 }
Пример #2
0
 /// <summary>
 /// Initializes a new LabelStyle
 /// </summary>
 public LabelStyle()
 {
     _Font                = new Font("Times New Roman", 12f);
     _Offset              = new PointF(0, 0);
     _CollisionDetection  = false;
     _CollisionBuffer     = new Size(0, 0);
     _ForeColor           = Color.Black;
     _HorisontalAlignment = HorizontalAlignmentEnum.Center;
     _VerticalAlignment   = VerticalAlignmentEnum.Middle;
 }
Пример #3
0
 protected LabelStyle(LabelStyle another) : base(another)
 {
     _Font                = (Font)another.Font.Clone();
     _Offset              = another.Offset;
     _CollisionDetection  = another.CollisionDetection;
     _CollisionBuffer     = another.CollisionBuffer;
     _ForeColor           = another.ForeColor;
     _HorisontalAlignment = another.HorizontalAlignment;
     _VerticalAlignment   = another.VerticalAlignment;
 }
Пример #4
0
 /// <summary>
 /// Initializes a new LabelStyle
 /// </summary>
 public LabelStyle()
 {
     _Font                = new Font(FontFamily.GenericSerif, 12f);
     _Offset              = new PointF(0, 0);
     _CollisionDetection  = false;
     _CollisionBuffer     = new Size(0, 0);
     _ForeColor           = Color.Black;
     _HorizontalAlignment = HorizontalAlignmentEnum.Center;
     _VerticalAlignment   = VerticalAlignmentEnum.Middle;
 }
Пример #5
0
        protected LabelStyle(LabelStyle another) : base(another)
        {
            _Font               = (Font)another.Font.Clone();
            _Offset             = another.Offset;
            _CollisionDetection = another.CollisionDetection;
            _CollisionBuffer    = another.CollisionBuffer;
            _ForeColor          = another.ForeColor;

            if (another.BackColor != null && another.BackColor is SolidBrush)
            {
                _BackColor = new SolidBrush((another.BackColor as SolidBrush).Color);
            }
            if (another.Halo != null)
            {
                _Halo = new Pen(another.Halo.Color, another.Halo.Width);
            }

            _Offset = another._Offset;
            _HorisontalAlignment = another.HorizontalAlignment;
            _VerticalAlignment   = another.VerticalAlignment;
        }
Пример #6
0
    /// <summary>
    /// Arranges the child vertical in a given area. If the area is bigger than the child's desired
    /// size, the child will be arranged according to the given <paramref name="alignment"/>.
    /// </summary>
    /// <param name="child">The child to arrange. The child will not be changed by this method.</param>
    /// <param name="alignment">Alignment in vertical direction.</param>
    /// <param name="location">Input: The starting position of the available area. Output: The position
    /// the child should be located.</param>
    /// <param name="childSize">Input: The available area for the <paramref name="child"/>. Output:
    /// The area the child should take.</param>
    public void ArrangeChildVertical(FrameworkElement child, VerticalAlignmentEnum alignment, ref PointF location, ref SizeF childSize)
    {
      // See comment in ArrangeChild
      SizeF desiredSize = child.DesiredSize;

      if (!double.IsNaN(desiredSize.Height) && desiredSize.Height <= childSize.Height)
      {
        // Height takes precedence over Stretch - Use Center as fallback
        if (alignment == VerticalAlignmentEnum.Center ||
            (alignment == VerticalAlignmentEnum.Stretch && !double.IsNaN(child.Height)))
        {
          location.Y += (childSize.Height - desiredSize.Height) / 2;
          childSize.Height = desiredSize.Height;
        }
        else if (alignment == VerticalAlignmentEnum.Bottom)
        {
          location.Y += childSize.Height - desiredSize.Height;
          childSize.Height = desiredSize.Height;
        }
        else if (alignment == VerticalAlignmentEnum.Top)
        {
          // Leave location unchanged
          childSize.Height = desiredSize.Height;
        }
        //else if (child.VerticalAlignment == VerticalAlignmentEnum.Stretch)
        // - Use all the space, nothing to do here
      }
    }
Пример #7
0
 /// <summary>
 /// Arranges the child horizontal and vertical in a given area. If the area is bigger than
 /// the child's desired size, the child will be arranged according to the given <paramref name="horizontalAlignment"/>
 /// and <paramref name="verticalAlignment"/>.
 /// </summary>
 /// <param name="child">The child to arrange. The child will not be changed by this method.</param>
 /// <param name="horizontalAlignment">Alignment in horizontal direction.</param>
 /// <param name="verticalAlignment">Alignment in vertical direction.</param>
 /// <param name="location">Input: The starting position of the available area. Output: The position
 /// the child should be located.</param>
 /// <param name="childSize">Input: The available area for the <paramref name="child"/>. Output:
 /// The area the child should take.</param>
 public void ArrangeChild(FrameworkElement child, HorizontalAlignmentEnum horizontalAlignment, VerticalAlignmentEnum verticalAlignment, ref PointF location, ref SizeF childSize)
 {
   // Be careful when changing the implementation of those arrangement methods.
   // MPF behaves a bit different from WPF: We don't clip elements at the boundaries of containers,
   // instead, we arrange them with a maximum size calculated by the container. If we would not avoid
   // that controls can become bigger than their arrange size, we would have to accomplish a means to clip
   // their render size.
   ArrangeChildHorizontal(child, horizontalAlignment, ref location, ref childSize);
   ArrangeChildVertical(child, verticalAlignment, ref location, ref childSize);
 }
Пример #8
0
 /// <summary>
 /// Initializes a new LabelStyle
 /// </summary>
 public LabelStyle()
 {
     _Font = new Font(FontFamily.GenericSerif, 12f);
     _Offset = new PointF(0, 0);
     _CollisionDetection = false;
     _CollisionBuffer = new Size(0, 0);
     _ForeColor = Color.Black;
     _HorizontalAlignment = HorizontalAlignmentEnum.Center;
     _VerticalAlignment = VerticalAlignmentEnum.Middle;
 }
Пример #9
0
	    protected LabelStyle(LabelStyle another) : base(another)
	    {
	        _Font = (Font) another.Font.Clone();
            _Offset = another.Offset;
            _CollisionDetection = another.CollisionDetection;
            _CollisionBuffer = another.CollisionBuffer;
            _ForeColor = another.ForeColor;
            _HorisontalAlignment = another.HorizontalAlignment;
            _VerticalAlignment = another.VerticalAlignment;
	    }
        /// <summary>
        /// Helper method to process single rows of a table.
        /// </summary>
        /// <param name="table"></param>
        /// <param name="columns"></param>
        /// <param name="data"></param>
        /// <param name="style"></param>
        /// <param name="verticalAlignment"></param>
        private static void ProcessRow(Table table, List <ColumnDefinition> columns, List <string> data, Style style, VerticalAlignmentEnum verticalAlignment)
        {
            var row = table.AddRow();

            if (verticalAlignment != VerticalAlignmentEnum.Center)
            {
                row.VerticalAlignment = verticalAlignment.ConvertEnum <VerticalAlignment>();
            }
            else
            {
                row.VerticalAlignment = VerticalAlignment.Center;
            }


            for (int i = 0; i < data.Count; i++)
            {
                switch (columns[i].Type)
                {
                case ColumnTypeEnum.Text:
                    var textField = row.Cells[i].AddParagraph();
                    textField.Style = style.Name;
                    textField.AddText(data[i]);
                    break;

                case ColumnTypeEnum.Image:
                    AddImage(row.Cells[i], data[i], columns[i].WidthInCm);
                    break;

                case ColumnTypeEnum.PageNum:
                    var pagenumField = row.Cells[i].AddParagraph();
                    pagenumField.Style = style.Name;
                    pagenumField.AddPageField();
                    pagenumField.AddText(" (");
                    pagenumField.AddNumPagesField();
                    pagenumField.AddText(")");
                    break;
                }
            }
        }
Пример #11
0
 /// <summary>
 /// Initializes a new LabelStyle
 /// </summary>
 public LabelStyle()
 {
     _Font = new Font() { FontFamily = "Times New Roman", Size = 12 };
     _Offset = new Offset() { X = 0, Y = 0 };
     _CollisionDetection = false;
     _CollisionBuffer = new Size() { Width = 0, Height = 0 };
     _ForeColor = Color.Black;
     _HorisontalAlignment = HorizontalAlignmentEnum.Center;
     _VerticalAlignment = VerticalAlignmentEnum.Middle;
 }
 internal VerticalAlignment(VerticalAlignmentEnum alignment)
 {
     _alignment = alignment;
 }
Пример #13
0
	    protected LabelStyle(LabelStyle another) : base(another)
	    {
	        _Font = (Font) another.Font.Clone();
	        _Offset = another.Offset;
	        _CollisionDetection = another.CollisionDetection;
	        _CollisionBuffer = another.CollisionBuffer;
	        _ForeColor = another.ForeColor;

	        if (another.BackColor != null && another.BackColor is SolidBrush)
	        {
	            _BackColor = new SolidBrush((another.BackColor as SolidBrush).Color);
	        }
	        if (another.Halo != null)
	        {
	            _Halo = new Pen(another.Halo.Color, another.Halo.Width);
	        }
	        
	        _Offset = another._Offset;
            _HorisontalAlignment = another.HorizontalAlignment;
            _VerticalAlignment = another.VerticalAlignment;
	    }