コード例 #1
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;
 }
コード例 #2
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;
 }
コード例 #3
0
ファイル: LabelStyle.cs プロジェクト: stophun/fdotoolbox
 /// <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;
 }
コード例 #4
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;
 }
コード例 #5
0
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            var page = sender as CustomNavigationPage;

            FontFamily = page.TitleFontFamily;
            TitleHorizontalAlignment = page.TitleHorizontalAlignment;
            TitleFontAttributes      = page.TitleFontAttributes;
            TitleFontSize            = page.TitleFontSize;
        }
コード例 #6
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;
        }
コード例 #7
0
    /// <summary>
    /// Arranges the child horizontal 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 horizontal 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 ArrangeChildHorizontal(FrameworkElement child, HorizontalAlignmentEnum alignment, ref PointF location, ref SizeF childSize)
    {
      // See comment in ArrangeChild
      SizeF desiredSize = child.DesiredSize;

      if (!double.IsNaN(desiredSize.Width) && desiredSize.Width <= childSize.Width)
      {
        // Width takes precedence over Stretch - Use Center as fallback
        if (alignment == HorizontalAlignmentEnum.Center ||
            (alignment == HorizontalAlignmentEnum.Stretch && !double.IsNaN(child.Width)))
        {
          location.X += (childSize.Width - desiredSize.Width) / 2;
          childSize.Width = desiredSize.Width;
        }
        if (alignment == HorizontalAlignmentEnum.Right)
        {
          location.X += childSize.Width - desiredSize.Width;
          childSize.Width = desiredSize.Width;
        }
        else if (alignment == HorizontalAlignmentEnum.Left)
        {
          // Leave location unchanged
          childSize.Width = desiredSize.Width;
        }
        //else if (child.HorizontalAlignment == HorizontalAlignmentEnum.Stretch)
        // - Use all the space, nothing to do here
      }
    }
コード例 #8
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);
 }
コード例 #9
0
ファイル: LabelStyle.cs プロジェクト: lishxi/_SharpMap
 /// <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;
 }
コード例 #10
0
ファイル: LabelStyle.cs プロジェクト: lishxi/_SharpMap
	    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;
	    }
コード例 #11
0
ファイル: PDFCreator.cs プロジェクト: dibiancoj/ToracLibrary
 /// <summary>
 /// Convert the enum to the int which can be set in itextsharp
 /// </summary>
 /// <param name="WhichAlignment">Which Alignment to use</param>
 /// <returns>int value to set in itextsharp</returns>
 public static int SetHorizontalAlignmentEnum(HorizontalAlignmentEnum WhichAlignment)
 {
     //return the int value
     return (int)WhichAlignment;
 }
コード例 #12
0
ファイル: PDFCreator.cs プロジェクト: dibiancoj/ToracLibrary
        /// <summary>
        /// Create a table object with it's column headers and the default settings
        /// </summary>
        /// <param name="ColumnCount">How Many Columns In This Table</param>
        /// <param name="TableAlignment">Table Alignment</param>
        /// <param name="TableWidthInPercentage">Table Width In Percent Relative To Page. 100% would be entire width of page</param>
        /// <returns>PdfPTable</returns>
        public static PdfPTable BuildTableTemplate(int ColumnCount, HorizontalAlignmentEnum? TableAlignment, float? TableWidthInPercentage)
        {
            //create the table object
            PdfPTable TableTemplateToBuild = new PdfPTable(ColumnCount);

            //set the table SetHorizontalAlignmentEnum
            if (TableAlignment.HasValue)
            {
                TableTemplateToBuild.HorizontalAlignment = SetHorizontalAlignmentEnum(TableAlignment.Value);
            }

            //set the table width of the page (100%)
            if (TableWidthInPercentage.HasValue)
            {
                TableTemplateToBuild.WidthPercentage = TableWidthInPercentage.Value;
            }

            //return the table
            return TableTemplateToBuild;
        }
コード例 #13
0
ファイル: PDFCreator.cs プロジェクト: dibiancoj/ToracLibrary
        /// <summary>
        /// Builds a table cell
        /// </summary>
        /// <param name="TextInCell">Text In Cell</param>
        /// <param name="MakeBold">Make the text bold?</param>
        /// <param name="HorAlignment">Horizontal Alignment</param>
        /// <param name="BackgroundColorOfCell">Background Color Of Cell</param>
        /// <param name="Formatter">Format Of Cell Need this to determine if we should make font red, etc.</param>
        /// <param name="ColumnSpanInCells">How many cells to span horizontally</param>
        /// <param name="PaddingLeft">Padding Left</param>
        /// <param name="GridLines">GridLines In Cell</param>
        /// <returns>PdfPCell</returns>
        public static PdfPCell BuildCell(string TextInCell,
                                        string Formatter,
                                        bool MakeBold,
                                        HorizontalAlignmentEnum? HorAlignment,
                                        BaseColor BackgroundColorOfCell,
                                        int? ColumnSpanInCells,
                                        float? PaddingLeft,
                                        bool GridLines)
        {
            //let's go build up the cell with the formatted value
            PdfPCell CellToReturn = new PdfPCell(MakePhrase(TextInCell, MakeBold));

            //add the alignment
            if (HorAlignment.HasValue)
            {
                CellToReturn.HorizontalAlignment = SetHorizontalAlignmentEnum(HorAlignment.Value);
            }

            //if we have a background color then set it
            if (BackgroundColorOfCell != null)
            {
                CellToReturn.BackgroundColor = BackgroundColorOfCell;
            }

            //if we want to span horizontally then set it now
            if (ColumnSpanInCells.HasValue)
            {
                CellToReturn.Colspan = ColumnSpanInCells.Value;
            }

            //if we want a padding left then add it now
            if (PaddingLeft.HasValue)
            {
                CellToReturn.PaddingLeft = PaddingLeft.Value;
            }

            //if we don't want grid lines then remove them now
            if (!GridLines)
            {
                CellToReturn.Border = 0;
            }

            //return the cell
            return CellToReturn;
        }
コード例 #14
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;
 }
コード例 #15
0
 internal HorizontalAlignment(HorizontalAlignmentEnum alignment)
 {
     _alignment = alignment;
 }
コード例 #16
0
ファイル: LabelStyle.cs プロジェクト: lishxi/_SharpMap
	    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;
	    }