Exemple #1
0
 /// <summary>
 /// Constructs a new instance of <see cref="PointShort"/> from the specified <see cref="Size"/>.
 /// </summary>
 /// <param name="sz">The <see cref="Size"/> to construct the <see cref="PointShort"/> from.</param>
 /// <remarks>
 /// The <see cref="Size.Width"/> will become the <see cref="X"/> and the <see cref="Size.Height"/> will become the <see cref="Y"/>.
 /// </remarks>
 public PointShort(Size sz)
     : this()
 {
     _x = (short)(sz.Width);
     _y = (short)(sz.Height);
 }
Exemple #2
0
 /// <summary>
 /// Offsets a <see cref="PointShort"/> by the specified <see cref="Size"/>.
 /// </summary>
 /// <param name="pt">The <see cref="PointShort"/> that should be offset.</param>
 /// <param name="sz">The <see cref="Size"/> to offset by.</param>
 /// <returns>A new <see cref="PointShort"/> that has been offset.</returns>
 public static PointShort Add(PointShort pt, Size sz) => pt + sz;
Exemple #3
0
 /// <summary>
 /// Retrieves the size of a rectangular area into which a control can be fitted.
 /// </summary>
 /// <param name="proposedSize">The custom-sized area for a control.</param>
 /// <returns>An ordered pair of type <see cref="Size"/> representing the width and height of a rectangle.</returns>
 /// <remarks>
 /// http://msdn.microsoft.com/en-us/library/system.windows.forms.buttonbase.getpreferredsize(v=vs.110).aspx
 /// </remarks>
 public override Size GetPreferredSize(Size proposedSize) => new Size(Math.Min(Size.Width, proposedSize.Width), Math.Min(Size.Height, proposedSize.Height));
Exemple #4
0
 /// <summary>
 /// Subtracts a <see cref="PointShort"/> by a <see cref="Size"/>.
 /// </summary>
 /// <param name="pt">The <see cref="PointShort"/> to be subtracted from.</param>
 /// <param name="sz">The <see cref="Size"/> to subtract.</param>
 /// <returns>A <see cref="PointShort"/> representing the difference.</returns>
 public static PointShort Subtract(PointShort pt, Size sz) => pt - sz;
Exemple #5
0
 /// <summary>
 /// Sets the bounds of the form in desktop coordinates.
 /// </summary>
 /// <param name="x">The x-coordinate of the form's <see cref="Control.Location"/>.</param>
 /// <param name="y">The y-coordinate of the form's <see cref="Control.Location"/>.</param>
 /// <param name="width">The width of the form.</param>
 /// <param name="height">The height of the form.</param>
 /// <remarks>
 /// https://msdn.microsoft.com/en-us/library/system.windows.forms.form.setdesktopbounds(v=vs.110).aspx
 /// </remarks>
 public void SetDesktopBounds(int x, int y, int width, int height)
 {
     OnResizeBegin(new EventArgs());
     Location = new Point(x, y);
     Size = new Size(width, height);
     OnResize(new EventArgs());
     OnResizeEnd(new EventArgs());
 }
Exemple #6
0
 /// <summary>
 /// Constructs a new instance of <see cref="Point"/> from the specified <see cref="Size"/>.
 /// </summary>
 /// <param name="sz">The <see cref="Size"/> to construct the <see cref="Point"/> from.</param>
 /// <remarks>
 /// The <see cref="Size.Width"/> will become the <see cref="X"/> and the <see cref="Size.Height"/> will become the <see cref="Y"/>.
 /// </remarks>
 public Point(Size sz)
     : this()
 {
     _x = sz.Width;
     _y = sz.Height;
 }
Exemple #7
0
 /// <summary>
 /// Sets the bounds of the control to the specified location and size.
 /// </summary>
 /// <param name="x">The new <see cref="Left"/> property value of the control.</param>
 /// <param name="y">The new <see cref="Top"/> property value of the control.</param>
 /// <param name="width">The new <see cref="Width"/> property value of the control.</param>
 /// <param name="height">The new <see cref="Height"/> property value of the control.</param>
 /// <remarks>
 /// http://msdn.microsoft.com/en-us/library/z0tayb1b(v=vs.110).aspx
 /// </remarks>
 public void SetBounds(int x, int y, int width, int height)
 {
     Location = new Point(x, y);
     Size = new Size(width, height);
 }
Exemple #8
0
 /// <summary>
 /// Offsets a <see cref="PointF"/> by the specified <see cref="Size"/>.
 /// </summary>
 /// <param name="pt">The <see cref="PointF"/> that should be offset.</param>
 /// <param name="sz">The <see cref="Size"/> to offset by.</param>
 /// <returns>A new <see cref="PointF"/> that has been offset.</returns>
 public static PointF Add(PointF pt, Size sz) => pt + sz;
Exemple #9
0
 /// <summary>
 /// Subtracts a <see cref="PointF"/> by a <see cref="Size"/>.
 /// </summary>
 /// <param name="pt">The <see cref="PointF"/> to be subtracted from.</param>
 /// <param name="sz">The <see cref="Size"/> to subtract.</param>
 /// <returns>A <see cref="PointF"/> representing the difference.</returns>
 public static PointF Subtract(PointF pt, Size sz)=>pt - sz;
Exemple #10
0
 /// <summary>
 /// Subtracts a <see cref="Size"/> by another <see cref="Size"/>.
 /// </summary>
 /// <param name="sz1">The <see cref="Size"/> to be subtracted from.</param>
 /// <param name="sz2">The <see cref="Size"/> to subtract.</param>
 /// <returns>A <see cref="Size"/> representing the difference.</returns>
 public static Size Subtract(Size sz1, Size sz2) => sz1 - sz2;
Exemple #11
0
 /// <summary>
 /// Adds two <see cref="Size"/> structures together and returns the result.
 /// </summary>
 /// <param name="sz1">The first <see cref="Size"/> to add.</param>
 /// <param name="sz2">The second <see cref="Size"/> to add.</param>
 /// <returns>A new <see cref="Size"/> structure that is the addition of the provided structurs.</returns>
 public static Size Add(Size sz1, Size sz2) => sz1 + sz2;