예제 #1
0
        public Button(
            LayoutManager layoutManager,
            Region region,
            BorderBuilder borderBuilder,
            string name,
            FormattedString content,
            Alignments alignments,
            CharColors?backgroundFill = null)
            : base(
                layoutManager,
                region,
                borderBuilder,
                name)
        {
            this.text       = content;
            this.alignments = alignments;
            this.inverted   = false;

            if (backgroundFill.HasValue)
            {
                this.background = new Fill(this.InnerRegion, backgroundFill.Value);
            }

            this.InnerRegion.OnChanged +=
                (obj, e) =>
                this.label.Region.TryTranslate(e.AfterChange.TopLeft - e.BeforeChange.TopLeft, out _);

            this.Recalculate();
        }
예제 #2
0
        public Sprite(Texture2D texture, Alignments alignment)
        {
            this.texture   = texture;
            this.alignment = alignment;

            origin = CoreFunctions.ComputeOrigin(alignment, texture.Width, texture.Height);
        }
예제 #3
0
        /// <summary>
        /// Constructs a default LLVM-based ABI specification.
        /// </summary>
        /// <param name="unit">The compile unit used for ABI generation.</param>
        public DefaultLLVMABI(CompileUnit unit)
            : base(unit)
        {
            var backend = unit.Backend as LLVMBackend;

            if (backend == null)
            {
                throw new NotSupportedException(ErrorMessages.NotSupportedBackend);
            }
            LLVMTargetData = CreateTargetDataLayout(backend.LLVMTargetMachine);
            foreach (var managedAlignment in ManagedAlignments)
            {
                var managedType = managedAlignment.Key;
                var llvmType    = unit.GetType(managedType);
                var alignment   = ABIAlignmentOfType(LLVMTargetData, llvmType);
                // We need a special case for the builtin mapping of 64bit floats
                // to 32bit floats since this mapping changes the alignment logic.
                if (unit.Force32BitFloats && managedType == typeof(double))
                {
                    managedType = typeof(float);
                }
                if (ManagedAlignments[managedType] != alignment)
                {
                    throw new NotSupportedException(string.Format(
                                                        ErrorMessages.CustomABIImplementationRequired, managedAlignment.Key));
                }
                Alignments.Add(managedAlignment.Key, alignment);
            }
            AddNonBlittableTypes();
            AddPtrAlignment(ABIAlignmentOfType(
                                LLVMTargetData,
                                unit.LLVMContext.VoidPtrType));
        }
예제 #4
0
        public static Alignments RollAlignment(Random rnd)
        {
            Array      values = Enum.GetValues(typeof(Alignments));
            Alignments thing  = (Alignments)values.GetValue(rnd.Next(values.Length));

            return(thing);
        }
예제 #5
0
        public void Load(string filename)
        {
            elements.Clear();
            elements.AddRange(JsonUtilities.Deserialize <HudElement[]>(filename, true));

            foreach (HudElement element in elements)
            {
                Alignments alignment = element.Alignment;

                int offsetX = element.OffsetX;
                int offsetY = element.OffsetY;
                int x       = (alignment & Alignments.Left) == Alignments.Left
                                        ? offsetX
                                        : (alignment & Alignments.Right) == Alignments.Right
                                                ? Resolution.Width - offsetX
                                                : Resolution.Width / 2 + offsetX;

                int y = (alignment & Alignments.Top) == Alignments.Top
                                        ? offsetY
                                        : (alignment & Alignments.Bottom) == Alignments.Bottom
                                                ? Resolution.Height - offsetY
                                                : Resolution.Height / 2 + offsetY;

                element.Position = new Vector2(x, y);
                element.Initialize();
            }
        }
예제 #6
0
        /// <summary>
        ///     Adds text to the control.
        /// </summary>
        /// <param name="text">Text to add.</param>
        /// <param name="color">Text color.</param>
        /// <param name="font">Font to use.</param>
        public void AddText(string text, Color color, Alignments alignment = Alignments.Left, GameFont font = null)
        {
            if (String.IsNullOrEmpty(text))
            {
                return;
            }

            if (font == null && mFont != null)
            {
                font = mFont;
            }

            var lines = text.Split(mNewline, StringSplitOptions.None);

            for (var i = 0; i < lines.Length; i++)
            {
                if (i > 0)
                {
                    AddLineBreak();
                }

                var block = new TextBlock
                {
                    Type      = BlockType.Text,
                    Text      = lines[i],
                    Color     = color,
                    Font      = font,
                    Alignment = alignment
                };

                mTextBlocks.Add(block);
                mNeedsRebuild = true;
                Invalidate();
            }
        }
        /// <summary>
        /// Takes a string and adds trailing or leading spaces to convert it to the specified length
        /// CENTER does not work AS of 7-9-03 (AJ)
        /// </summary>
        /// <param name="convstring">The string to convert</param>
        /// <param name="length">The length of the fixed length string</param>
        /// <param name="align">Alignment of the text within the string (NO CENTER)</param>
        /// <returns></returns>
        public static string ToFixedLength(string convstring, int length, Alignments align)
        {
            string fromstring = convstring;

            if (align == Alignments.Right)
            {
                while (fromstring.Length < length)
                {
                    fromstring = " " + fromstring;
                }
                return(fromstring);
            }
            else if (align == Alignments.Left)
            {
                while (fromstring.Length < length)
                {
                    fromstring += " ";
                }
                return(fromstring);
            }
            else if (align == Alignments.Center)
            {
                return(fromstring);
            }
            else             // never happens unlesss alignment type is uncoded for
            {
                return("");
            }
        }
        /// <summary>
        /// Returns the column state information for the current object (used for rendering).
        /// Includes max width of column, alignment and index
        /// </summary>
        /// <returns></returns>
        public ColumnState[] GetColumnState()
        {
            if (ColumnsExpected < 1)
            {
                return(new ColumnState[0]);
            }

            var columns = new ColumnState[ColumnsExpected];

            for (var i = 0; i < ColumnsExpected; ++i)
            {
                Alignment align;
                if (!Alignments.TryGetValue(i, out align))
                {
                    align = Alignment.Left;
                }

                columns[i] = new ColumnState
                {
                    Index = i,
                    Width = maxColumnLengths[i],
                    Align = align
                };
            }
            return(columns);
        }
예제 #9
0
        private ivec2 ComputePlacement(CanvasElement element)
        {
            Alignments anchor = element.Anchor;

            // Using a None anchor allows elements to not be automatically placed (and repositioned) by the canvas.
            if (anchor == Alignments.None)
            {
                return(element.Location);
            }

            bool left   = (anchor & Alignments.Left) > 0;
            bool right  = (anchor & Alignments.Right) > 0;
            bool top    = (anchor & Alignments.Top) > 0;
            bool bottom = (anchor & Alignments.Bottom) > 0;

            ivec2 dimensions = Resolution.WindowDimensions;
            ivec2 offset     = element.Offset;

            int width  = dimensions.x;
            int height = dimensions.y;
            int x      = left ? offset.x : (right ? width - offset.x : width / 2 + offset.x);
            int y      = top ? offset.y : (bottom ? height - offset.y : height / 2 + offset.y);

            return(new ivec2(x, y));
        }
예제 #10
0
 public void GetAndSetNameAndAlignment(string name, Alignments alignment)
 {
     _character.Name      = name;
     _character.Alignment = alignment;
     _character.Name.Should().Be(name);
     _character.Alignment.Should().Be(alignment);
 }
예제 #11
0
        public override void AdoptSettings(INodePlacer nodePlacer)
        {
            base.AdoptSettings(nodePlacer);
            var dnp = (DoubleLineNodePlacer)nodePlacer;

            RootAlignment = Alignments.First((kvp) => kvp.Value == dnp.RootAlignment).Key;
        }
예제 #12
0
		public SpriteText(SpriteFont font, string value = null,
			Alignments alignment = Alignments.Left | Alignments.Top) : base(alignment)
		{
			this.font = font;
			
			Value = value;
		}
예제 #13
0
        //对齐
        public ICellStyle SetAlignment(ICellStyle style, Alignments align = Alignments.None)
        {
            style = workBook.CreateCellStyle();

            switch (align)
            {
            case Alignments.左上:
                style.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Left;
                style.VerticalAlignment = VerticalAlignment.Top;
                break;

            case Alignments.左中:
                style.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Left;
                style.VerticalAlignment = VerticalAlignment.Center;
                break;

            case Alignments.左下:
                style.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Left;
                style.VerticalAlignment = VerticalAlignment.Bottom;
                break;

            case Alignments.中上:
                style.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Center;
                style.VerticalAlignment = VerticalAlignment.Top;
                break;

            case Alignments.中中:
                style.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Center;
                style.VerticalAlignment = VerticalAlignment.Center;
                break;

            case Alignments.中下:
                style.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Center;
                style.VerticalAlignment = VerticalAlignment.Bottom;
                break;

            case Alignments.右上:
                style.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Right;
                style.VerticalAlignment = VerticalAlignment.Top;
                break;

            case Alignments.右中:
                style.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Right;
                style.VerticalAlignment = VerticalAlignment.Center;
                break;

            case Alignments.右下:
                style.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Right;
                style.VerticalAlignment = VerticalAlignment.Bottom;
                break;

            default:
                style.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Left;
                style.VerticalAlignment = VerticalAlignment.Center;
                break;
            }

            return(style);
        }
        public override void AdoptSettings(INodePlacer nodePlacer)
        {
            base.AdoptSettings(nodePlacer);
            var dnp = (SimpleNodePlacer)nodePlacer;

            CreateBus     = dnp.CreateBus;
            RootAlignment = Alignments.First(kvp => kvp.Value == dnp.RootAlignment).Key;
        }
예제 #15
0
        public Sprite(QuadSource source, Bounds2D sourceRect = null, Alignments alignment = Alignments.Center) :
            base(alignment)
        {
            this.source     = source;
            this.sourceRect = sourceRect;

            data = new float[QuadSize];
        }
예제 #16
0
        public SpriteText(SpriteFont font, string value, Alignments alignment)
        {
            this.font      = font;
            this.alignment = alignment;

            Value = value;
            Color = Color.White;
        }
예제 #17
0
 public Character(int hp, Races r, Alignments a, String name, String gender)
 {
     mName        = name;
     mGender      = gender;
     healthPoints = hp;
     race         = r;
     alignment    = a;
 }
예제 #18
0
        public Sprite(QuadSource source, SourceRect sourceRect, Alignments alignment = Alignments.Center,
                      SpriteModifiers mods = SpriteModifiers.None) : base(alignment, mods)
        {
            this.source     = source;
            this.sourceRect = sourceRect;

            data = new float[QuadSize];
        }
예제 #19
0
        public void CharacterHasAlignment(
            [Values(Alignments.GOOD, Alignments.EVIL, Alignments.NEUTRAL)] Alignments TAlignment)
        {
            character.alignment = TAlignment;
            Alignments actualAlignment = character.alignment;

            Assert.AreEqual(TAlignment, actualAlignment);
        }
예제 #20
0
 //
 // MonoBehaviour
 //
 override protected void Reset()
 {
     base.Reset();
     this.Alignment            = Anchor.Alignments.TopLeft;
     this.IsDeviceSpecific     = false;
     this.MarginInPointsKindle = Vector2.zero;
     this.MarginInPointsPad    = Vector2.zero;
     this.MarginInPointsPhone  = Vector2.zero;
 }
예제 #21
0
 public FontStyle Default()
 {
     this.color      = HSSFColor.Black.Index;
     this.size       = 12;
     this.fontType   = "宋体";
     this.Align      = Alignments.None;
     this.dataFormat = string.Empty;
     return(this);
 }
예제 #22
0
        // TODO: Support modifiers on text (e.g. flip vertical or horizontal).
        public SpriteText(SpriteFont font, vec2 position, string value = null,
                          Alignments alignment = Alignments.Left | Alignments.Top, bool useLiteralMeasuring = false) :
            base(alignment, SpriteModifiers.None)
        {
            this.font = font;
            this.useLiteralMeasuring = useLiteralMeasuring;

            Value = value;
            Position.SetValue(position, false);
        }
 public ShowAttribute(bool show, int width = -1, Alignments alignment = Alignments.left, string header = null, string formatStr = null, bool hideIfNull = false, bool isBold = false)
 {
     Show       = show;
     Width      = width;
     Alignment  = alignment;
     Header     = header;
     FormatStr  = formatStr;
     HideIfNull = hideIfNull;
     IsBold     = isBold;
 }
예제 #24
0
 // For the time being, source rects for 3D sprites aren't supported (in order to simplify the rendering
 // process). This might be fine, even if source rects are never added.
 public Sprite3D(QuadSource source, Alignments alignment = Alignments.Center)
 {
     Source = source;
     origin = Utilities.ComputeOrigin(source.Width, source.Height, alignment) -
              new ivec2(source.Width, source.Height) / 2;
     Scale          = vec2.Ones;
     Orientation    = quat.Identity;
     Color          = Color.White;
     IsShadowCaster = true;
 }
예제 #25
0
 /// <summary>
 /// Registers default non-blittable types.
 /// </summary>
 protected void AddNonBlittableTypes()
 {
     foreach (var type in NonBlittableTypes)
     {
         if (Alignments.ContainsKey(type))
         {
             continue;
         }
         Alignments.Add(type, GetAlignmentOf(type));
     }
 }
예제 #26
0
    public GUIElement NewFrame(Alignments hAlign, float x, Alignments vAlign, float y, float width, float height)
    {
        GUIElement element = new GUIElement();

        element.HAlignement = hAlign;
        element.VAlignement = vAlign;
        element.Bounds      = new Rect(x, y, width, height);
        element.ElementType = GUIElement.ElementTypes.Frame;
        Elements.Add(element);
        return(element);
    }
예제 #27
0
        protected Component2D(Alignments alignment)
        {
            this.alignment = alignment;

            scale           = vec2.Ones;
            color           = Color.White;
            mods            = SpriteModifiers.None;
            positionChanged = true;
            sourceChanged   = true;
            colorChanged    = true;
        }
예제 #28
0
        public Rect GetDockingRect(Size sizeToDock, Margins margins, Alignments alignments)
        {
            var marginsCutout = margins.AsThickness();
            var withoutMargins = OriginalRect.Deflate(marginsCutout);
            var finalRect = withoutMargins.AlignChild(sizeToDock, Alignment.Start, alignments.Vertical);

            AccumulatedOffset += sizeToDock.Width;
            margins.HorizontalMargin = margins.HorizontalMargin.Offset(sizeToDock.Width, 0);

            return finalRect;
        }
예제 #29
0
 protected Component2D(Alignments alignment, SpriteModifiers mods)
 {
     Alignment     = alignment;
     Mods          = mods;
     flags         = new Flags <TransformFlags>(TransformFlags.IsSourceChanged);
     positionField = new RenderPosition2DField(flags);
     scaleField    = new RenderScale2DField(flags);
     rotationField = new RenderRotationField(flags);
     colorField    = new RenderColorField(flags);
     IsDrawEnabled = true;
 }
예제 #30
0
 public Character(string name  = "Name", Alignments alignment = Alignments.Neutral,
                  int strength = 10, int dexterity            = 10, int constitution = 10, int wisdom = 10, int intelligence = 10, int charisma = 10)
 {
     Name         = name;
     Alignment    = alignment;
     Strength     = strength;
     Dexterity    = dexterity;
     Constitution = constitution;
     Wisdom       = wisdom;
     Intelligence = intelligence;
     Charisma     = charisma;
 }
예제 #31
0
        public static ivec2 ComputeOrigin(int width, int height, Alignments alignment)
        {
            bool left   = (alignment & Alignments.Left) > 0;
            bool right  = (alignment & Alignments.Right) > 0;
            bool top    = (alignment & Alignments.Top) > 0;
            bool bottom = (alignment & Alignments.Bottom) > 0;

            var x = left ? 0 : (right ? width : width / 2);
            var y = top ? 0 : (bottom ? height : height / 2);

            return(new ivec2(x, y));
        }
예제 #32
0
 public StyleState(StyleState parent)
 {
     m_IsUnderlined = parent.m_IsUnderlined;
     IsBold = parent.IsBold;
     IsItalic = parent.IsItalic;
     IsOutlined = parent.IsOutlined;
     Font = parent.Font;
     Alignment = parent.Alignment;
     Color = parent.Color;
     HREF = parent.HREF;
     ElementWidth = parent.ElementWidth;
     ElementHeight = parent.ElementHeight;
     GumpImgSrc = parent.GumpImgSrc;
     GumpImgSrcOver = parent.GumpImgSrcOver;
     GumpImgSrcDown = parent.GumpImgSrcDown;
 }
예제 #33
0
    public GUIElement NewImage(Alignments hAlign, float x, Alignments vAlign, float y, Texture image)
    {
        GUIElement element = new GUIElement();

        element.HAlignement = hAlign;
        element.VAlignement = vAlign;
        element.Bounds = new Rect(x, y, image.width, image.height);
        element.BackgroundImage = image;
        element.ElementType = GUIElement.ElementTypes.Image;

        Elements.Add(element);
        return element;
    }
예제 #34
0
        /// <summary>
        /// 从当前坐标为起点,绘制一行文字
        /// </summary>
        /// <param name="text">文字内容</param>
        /// <param name="font">文字字体,包含字体样式、字号等</param>
        /// <param name="foreBrush">文字画笔,包含字体颜色、样式等</param>
        /// <param name="indent">缩进值,单位为:字符</param>
        /// <param name="whiteSpace">字间距,单位为:像素</param>
        /// <param name="align">文字对齐方式</param>
        public void DrawText(String text, Font font, Brush foreBrush, int indent, double whiteSpace, Alignments align)
        {
            var chars = text.ToCharArray();
            var text_length = chars.Length * (font.Size + whiteSpace);//字符长度
            Double _x = 0, _y = 0;
            if (align == Alignments.Left)
            {
                _x = _paper.Location.X + ((font.Size + whiteSpace) * indent);
            }
            else if (align == Alignments.Middle)
            {
                var left = (_paper.Width - _paper.Thickness.Left - _paper.Thickness.Right - text_length) / 2;
                _x = _paper.Location.X + left + ((font.Size + whiteSpace) * indent);
            }
            else
            {
                var left = _paper.Width - _paper.Thickness.Left - _paper.Thickness.Right - text_length;
                _x = _paper.Location.X + left;
            }

            _graphic.DrawString(text, font, foreBrush, (int)_paper.Location.X, (int)_paper.Location.Y);
        }
예제 #35
0
    public GUIElement NewButton(Alignments hAlign, float x, Alignments vAlign, float y, float width, float height, string text, EventHandler handler)
    {
        GUIElement element = new GUIElement();

        element.HAlignement = hAlign;
        element.VAlignement = vAlign;
        element.Bounds = new Rect(x, y, width, height);
        element.Name = text;
        element.ElementType = GUIElement.ElementTypes.Button;

        element.Clicked += handler;

        Elements.Add(element);
        return element;
    }
예제 #36
0
    public GUIElement NewFrame(Alignments hAlign, float x, Alignments vAlign, float y, float width, float height)
    {
        GUIElement element = new GUIElement();

        element.HAlignement = hAlign;
        element.VAlignement = vAlign;
        element.Bounds = new Rect(x, y, width, height);
        element.ElementType = GUIElement.ElementTypes.Frame;
        Elements.Add(element);
        return element;
    }
예제 #37
0
    public GUIElement NewImageButton(Alignments hAlign, float x, Alignments vAlign, float y, Texture image, EventHandler handler)
    {
        GUIElement element = new GUIElement();

        element.HAlignement = hAlign;
        element.VAlignement = vAlign;
        element.Bounds = new Rect(x, y, image.width, image.height);
        element.BackgroundImage = image;
        element.ElementType = GUIElement.ElementTypes.Button;

        element.Clicked += handler;

        Elements.Add(element);
        return element;
    }
예제 #38
0
    public GUIElement NewLabel(Alignments hAlign, float x, Alignments vAlign, float y, float width, float height, string text)
    {
        GUIElement element = new GUIElement();

        element.HAlignement = hAlign;
        element.VAlignement = vAlign;
        element.Bounds = new Rect(x, y, width, height);
        element.Name = text;
        element.ElementType = GUIElement.ElementTypes.Label;

        Elements.Add(element);
        return element;
    }
예제 #39
0
        /// <summary>
        /// Loads in the object's data from the data file associated with that object
        /// </summary>
        private void LoadObjectData()
        {
            try
            {
                using (Stream stream = TitleContainer.OpenStream("Data/PhysicsObjectData/" + objectName + ".txt"))
                {
                    using (StreamReader sr = new StreamReader(stream))
                    {
                        String line = GameResources.getNextDataLine(sr, "#");
                        isGravityAffected = Convert.ToBoolean(int.Parse(line));

                        line = GameResources.getNextDataLine(sr, "#");
                        movesOffEdges = Convert.ToBoolean(int.Parse(line));

                        line = GameResources.getNextDataLine(sr, "#");
                        sticksToSurfaces = Convert.ToBoolean(int.Parse(line));

                        line = GameResources.getNextDataLine(sr, "#");
                        alignment = (Alignments)int.Parse(line);

                        line = GameResources.getNextDataLine(sr, "#");
                        maxHealth = int.Parse(line);

                        currentHealth = maxHealth;

                        line = GameResources.getNextDataLine(sr, "#");
                        armor = float.Parse(line);

                        line = GameResources.getNextDataLine(sr, "#");
                        movementSpeed = int.Parse(line);

                        line = GameResources.getNextDataLine(sr, "#");
                        interactionDistance = int.Parse(line);

                        line = GameResources.getNextDataLine(sr, "#");
                        string[] numbers = line.Split(' ');
                        collisionXs = new short[numbers.Count()];
                        for (int i = 0; i < numbers.Count(); i++)
                            collisionXs[i] = short.Parse(numbers[i]);

                        line = GameResources.getNextDataLine(sr, "#");
                        numbers = line.Split(' ');
                        collisionYs = new short[numbers.Count()];
                        for (int i = 0; i < numbers.Count(); i++)
                            collisionYs[i] = short.Parse(numbers[i]);

                        sr.Close();
                    }
                }

            }
            catch (FileNotFoundException e)
            {
                System.Diagnostics.Debug.WriteLine("The file could not be found: " + e.Message);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("An error occurred: " + e.Message);
                isGravityAffected = false;
                movesOffEdges = false;
                alignment = 0;
                maxHealth = 0;
                armor = 0;
                movementSpeed = 0;
                interactionDistance = 0;
                collisionXs = new short[1] { 0 };
                collisionYs = new short[1] { 0 };
            }
        }
예제 #40
0
    public GUIElement NewScrollView(Alignments hAlign, float x, Alignments vAlign, float y, float width, float height, Rect innerSize, bool horizontal)
    {
        GUIElement element = new GUIElement();

        element.HAlignement = hAlign;
        element.VAlignement = vAlign;
        element.Bounds = new Rect(x, y, width, height);
        element.ElementType = horizontal ? GUIElement.ElementTypes.HorizontalScrollFrame : GUIElement.ElementTypes.VerticalScrollFrame;
        element.InnerSize = innerSize;
        Elements.Add(element);
        return element;
    }
예제 #41
0
        /// <summary>
        /// Aligns elements with each other or with the margins
        /// </summary>
        /// <param name="elements">A list of elements to align</param>
        /// <param name="side">The side to align to</param>
        /// <param name="margin">True to align to paper margins, false to align to the most extreme element of the indicated side</param>
        public void AlignElements(List<LayoutElement> elements, Alignments side, bool margin)
        {
            switch (side)
            {
                case Alignments.Left:
                    if (margin)
                    {
                        foreach (LayoutElement le in elements)
                            le.LocationF = new PointF(_printerSettings.DefaultPageSettings.Margins.Left, le.LocationF.Y);
                    }
                    else
                    {
                        float leftMost = float.MaxValue;
                        foreach (LayoutElement le in elements)
                            if (le.LocationF.X < leftMost) leftMost = le.LocationF.X;
                        foreach (LayoutElement le in elements)
                            le.LocationF = new PointF(leftMost, le.LocationF.Y);
                    }
                    break;
                case Alignments.Right:
                    if (margin)
                    {
                        float rightMost = PaperWidth - _printerSettings.DefaultPageSettings.Margins.Right;
                        foreach (LayoutElement le in elements)
                            le.LocationF = new PointF(rightMost - le.Size.Width, le.LocationF.Y);
                    }
                    else
                    {
                        float rightMost = float.MinValue;
                        foreach (LayoutElement le in elements)
                            if (le.LocationF.X + le.Size.Width > rightMost) rightMost = le.LocationF.X + le.Size.Width;
                        foreach (LayoutElement le in elements)
                            le.LocationF = new PointF(rightMost - le.Size.Width, le.LocationF.Y);
                    }
                    break;
                case Alignments.Top:
                    if (margin)
                    {
                        foreach (LayoutElement le in elements)
                            le.LocationF = new PointF(le.LocationF.X, _printerSettings.DefaultPageSettings.Margins.Top);
                    }
                    else
                    {
                        float topMost = float.MaxValue;
                        foreach (LayoutElement le in elements)
                            if (le.LocationF.Y < topMost) topMost = le.LocationF.Y;
                        foreach (LayoutElement le in elements)
                            le.LocationF = new PointF(le.LocationF.X, topMost);
                    }
                    break;
                case Alignments.Bottom:
                    if (margin)
                    {
                        float bottomMost = PaperHeight - _printerSettings.DefaultPageSettings.Margins.Bottom;
                        foreach (LayoutElement le in elements)
                            le.LocationF = new PointF(le.LocationF.X, bottomMost - le.Size.Height);
                    }
                    else
                    {
                        float bottomMost = float.MinValue;
                        foreach (LayoutElement le in elements)
                            if (le.LocationF.Y + le.Size.Height > bottomMost) bottomMost = le.LocationF.Y + le.Size.Height;
                        foreach (LayoutElement le in elements)
                            le.LocationF = new PointF(le.LocationF.X, bottomMost - le.Size.Height);
                    }
                    break;

                case Alignments.Horizontal:
                    if (margin)
                    {
                        float centerHor = PaperWidth / 2F;
                        foreach (LayoutElement le in elements)
                            le.LocationF = new PointF(centerHor - (le.Size.Width / 2F), le.LocationF.Y);
                    }
                    else
                    {
                        float centerHor = 0;
                        float widest = 0;
                        foreach (LayoutElement le in elements)
                            if (le.Size.Width > widest)
                            {
                                widest = le.Size.Width;
                                centerHor = le.LocationF.X + (widest / 2F);
                            }
                        foreach (LayoutElement le in elements)
                            le.LocationF = new PointF(centerHor - (le.Size.Width / 2F), le.LocationF.Y);
                    }
                    break;
                case Alignments.Vertical:
                    if (margin)
                    {
                        float centerVer = PaperHeight / 2F;
                        foreach (LayoutElement le in elements)
                            le.LocationF = new PointF(le.LocationF.X, centerVer - (le.Size.Height / 2F));
                    }
                    else
                    {
                        float centerVer = 0;
                        float tallest = 0;
                        foreach (LayoutElement le in elements)
                            if (le.Size.Height > tallest)
                            {
                                tallest = le.Size.Height;
                                centerVer = le.LocationF.Y + (tallest / 2F);
                            }
                        foreach (LayoutElement le in elements)
                            le.LocationF = new PointF(le.LocationF.X, centerVer - (le.Size.Height / 2F));
                    }
                    break;
            }
        }