System.Drawing.Size.Round C# (CSharp) Method

Round() public static method

Converts a SizeF to a Size by performing a round operation on all the coordinates.
public static Round ( SizeF value ) : Size
value SizeF
return Size
        public static Size Round(SizeF value) => new Size((int)Math.Round(value.Width), (int)Math.Round(value.Height));

Same methods

Size::Round ( System value ) : System.Drawing.Size

Usage Example

Beispiel #1
0
        public void Print(PrintPageEventArgs e, Brush brush, Point moveAll)
        {
            if (Font == null)
            {
                throw new ArgumentNullException("Line.Font");
            }
            if (Font.Value == null)
            {
                throw new ArgumentNullException("Line.Font.Value");
            }

            var lines = Text.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            Size size;

            for (int i = 0, y = (int)Y; i < lines.Length; i++, y += size.Height)
            {
                e.Graphics.DrawString(lines[i], Font.Value, brush, X + moveAll.X, y + moveAll.Y);
                size = SSize.Round(e.Graphics.MeasureString(lines[i], Font.Value));
            }
        }
All Usage Examples Of System.Drawing.Size::Round