Class Utility
Contains utility functions.
Inheritance
Namespace: Manina.Windows.Forms
Assembly: ImageListView.dll
Syntax
public static class Utility
Methods
| Improve this Doc View SourceDrawRoundedRectangle(Graphics, Pen, Rectangle, Int32)
Draws the outline of a rounded rectangle.
Declaration
public static void DrawRoundedRectangle(Graphics graphics, Pen pen, Rectangle rect, int radius)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | graphics | The graphics to draw on. |
System.Drawing.Pen | pen | The pen to use to draw the rectangle. |
System.Drawing.Rectangle | rect | The rectangle to draw. |
System.Int32 | radius | The radius of rounded corners. |
DrawRoundedRectangle(Graphics, Pen, RectangleF, Single)
Draws the outline of a rounded rectangle.
Declaration
public static void DrawRoundedRectangle(Graphics graphics, Pen pen, RectangleF rect, float radius)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | graphics | The graphics to draw on. |
System.Drawing.Pen | pen | The pen to use to draw the rectangle. |
System.Drawing.RectangleF | rect | The rectangle to draw. |
System.Single | radius | The radius of rounded corners. |
DrawRoundedRectangle(Graphics, Pen, Int32, Int32, Int32, Int32, Int32)
Draws the outline of a rounded rectangle.
Declaration
public static void DrawRoundedRectangle(Graphics graphics, Pen pen, int x, int y, int width, int height, int radius)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | graphics | The graphics to draw on. |
System.Drawing.Pen | pen | The pen to use to draw the rectangle. |
System.Int32 | x | The x-coordinate of the upper-left corner of the rectangle to draw. |
System.Int32 | y | The y-coordinate of the upper-left corner of the rectangle to draw. |
System.Int32 | width | Width of the rectangle to draw. |
System.Int32 | height | Height of the rectangle to draw. |
System.Int32 | radius | The radius of rounded corners. |
DrawRoundedRectangle(Graphics, Pen, Single, Single, Single, Single, Single)
Draws the outline of a rounded rectangle.
Declaration
public static void DrawRoundedRectangle(Graphics graphics, Pen pen, float x, float y, float width, float height, float radius)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | graphics | The graphics to draw on. |
System.Drawing.Pen | pen | The pen to use to draw the rectangle. |
System.Single | x | The x-coordinate of the upper-left corner of the rectangle to draw. |
System.Single | y | The y-coordinate of the upper-left corner of the rectangle to draw. |
System.Single | width | Width of the rectangle to draw. |
System.Single | height | Height of the rectangle to draw. |
System.Single | radius | The radius of rounded corners. |
FillRoundedRectangle(Graphics, Brush, Rectangle, Int32)
Fills the interior of a rounded rectangle.
Declaration
public static void FillRoundedRectangle(Graphics graphics, Brush brush, Rectangle rect, int radius)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | graphics | The graphics to draw on. |
System.Drawing.Brush | brush | The brush to use to fill the rectangle. |
System.Drawing.Rectangle | rect | The rectangle to draw. |
System.Int32 | radius | The radius of rounded corners. |
FillRoundedRectangle(Graphics, Brush, RectangleF, Single)
Fills the interior of a rounded rectangle.
Declaration
public static void FillRoundedRectangle(Graphics graphics, Brush brush, RectangleF rect, float radius)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | graphics | The graphics to draw on. |
System.Drawing.Brush | brush | The brush to use to fill the rectangle. |
System.Drawing.RectangleF | rect | The rectangle to draw. |
System.Single | radius | The radius of rounded corners. |
FillRoundedRectangle(Graphics, Brush, Int32, Int32, Int32, Int32, Int32)
Fills the interior of a rounded rectangle.
Declaration
public static void FillRoundedRectangle(Graphics graphics, Brush brush, int x, int y, int width, int height, int radius)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | graphics | The graphics to draw on. |
System.Drawing.Brush | brush | The brush to use to fill the rectangle. |
System.Int32 | x | The x-coordinate of the upper-left corner of the rectangle to draw. |
System.Int32 | y | The y-coordinate of the upper-left corner of the rectangle to draw. |
System.Int32 | width | Width of the rectangle to draw. |
System.Int32 | height | Height of the rectangle to draw. |
System.Int32 | radius | The radius of rounded corners. |
FillRoundedRectangle(Graphics, Brush, Single, Single, Single, Single, Single)
Fills the interior of a rounded rectangle.
Declaration
public static void FillRoundedRectangle(Graphics graphics, Brush brush, float x, float y, float width, float height, float radius)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | graphics | The graphics to draw on. |
System.Drawing.Brush | brush | The brush to use to fill the rectangle. |
System.Single | x | The x-coordinate of the upper-left corner of the rectangle to draw. |
System.Single | y | The y-coordinate of the upper-left corner of the rectangle to draw. |
System.Single | width | Width of the rectangle to draw. |
System.Single | height | Height of the rectangle to draw. |
System.Single | radius | The radius of rounded corners. |
FormatSize(Int64)
Formats the given file size as a human readable string.
Declaration
public static string FormatSize(long size)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | size | File size in bytes. |
Returns
Type | Description |
---|---|
System.String | The formatted string. |
GetSizedImageBounds(Image, Rectangle)
Gets the bounding rectangle of an image required to fit in to the given rectangle keeping the image aspect ratio. The image will be centered in the fit box.
Declaration
public static Rectangle GetSizedImageBounds(Image image, Rectangle fit)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Image | image | The source image. |
System.Drawing.Rectangle | fit | The rectangle to fit in to. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | New image size. |
GetSizedImageBounds(Image, Rectangle, Single, Single)
Gets the bounding rectangle of an image required to fit in to the given rectangle keeping the image aspect ratio.
Declaration
public static Rectangle GetSizedImageBounds(Image image, Rectangle fit, float hAlign, float vAlign)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Image | image | The source image. |
System.Drawing.Rectangle | fit | The rectangle to fit in to. |
System.Single | hAlign | Horizontal image aligment in percent. |
System.Single | vAlign | Vertical image aligment in percent. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | New image size. |