RoundedBox is not very complicated server control but sometimes you will need some help on how to use it appropriately. Here it is.
Following table contains the reference documentation of all applicable properties. The table sorting roughly respects the properties importance.
Method |
Type: RoundMethod enumeration (with NoImages, PreparedImages and GenerateImages options)
Default value: NoImages
Chooses the rendering method. |
Width Height |
Type: Unit
Default value: Empty
Inherited from WebControl. Sets the width and height of the box. |
BackColor |
Type: Color
Inherited from WebControl. Sets the background color of the box. |
RadiusX,
RadiusY |
Type: Int32 (not Unit!)
Specifies the corners radius. Used by GenerateImages method. |
Padding,
PaddingTop,
PaddingRight,
PaddingBottom,
PaddingLeft |
Type: Padding is string, the others are of type Unit
Padding property uses CSS syntax, which means that it can be supplied with one to four values:
- one value: sets padding for all sides
- two values: the first one is for top and bottom sides, the second one for right and left sides
- three values: first is top, second is right and left, third is bottom
- four values: one for each side, clockwise starting with top
When selected method uses images, RoundedBox tries to compute default padding based on image dimensions. This is the reason why the user should always use these properties instead of standard CSS "padding" style rules. For details, see features page. |
UnderlayColor |
Type: Color
Sets the color of the surface on which the RoundedBox sits (e.g. the color of the page or of the parent div). When the surface uses some wild patterns, leave this property empty, rounded corners then will use transparency if possible. But when you know the surface color in advance, it's a good idea to set it because auto-aliasing will be used which produces somewhat better visual results. |
BorderColor,
BorderStyle,
BorderWidth |
Inherited from WebControl. RoundedBox will try to translate standard border into rounded corners border. Not applicable when using PreparedImages method. |
CornersToRound |
Type: string
Default value: "all"
Specifies which corners should be rounded. Applicable in NoImages and GenerateImages method. Allowed values are "all", "top", "bottom", "tl", "tr", "bl", "br" or some combination of those. |
OutputDir |
Type: string
Default value: "~"
Accepts any valid ASP.NET path. All emitted files (generated images, JS, CSS files) will be stored in this location. This is the way to prevent your top level web directory to be contaminated by many many server-generated files. Regarding the trailing slash ("first/example" vs. "second/example/"), RoundedBox will accept both alternatives but the first one is preferred. |
another standard properties |
... as for example Font, ForeColor and other properties inherited from WebControl. |
Image |
Type: RoundedImages class
Composite property containing information about images to create rounded corners efect. It will be used in PreparedImages method. See Image-subproperties. |
Image-Mode |
Type: ImageMode enumeration (with Corners, CornersAndEdges and TopMiddleBottom options)
- Corners - there are only images for corners prepared
- CornersAndEdges - there are 8 images, one for each corner and one for each edge; edge images are automatically repeated in the right direction (using repeat-x and repeat-y CSS properties)
- TopMiddleBottom - one image for top region, one for the middle one (it will repeat vertically) and one for the bottom area
There is no default value so you will get an error if you don't specify one.
|
Image-Top,
Image-TopRight,
Image-Right,
Image-Bottom,
Image-BottomRight,
Image-Bottom,
Image-BottomLeft,
Left,
TopLeft,
Middle |
Type: string
Each property sets the full path to one image. Any valid ASP.NET path is accepted. Generally, it's more convenient to specify file names indirectly, see other Image-* properties below. |
Image-Directory |
Type: string
Default value: "~"
Any valid ASP.NET path is accepted. Specifies directory name where rounded corners images reside. Can be used together with Image-Top, Image-TopRight etc. properties - in that case, the path to image is computed as Image-Directory + "/" + Image-Top . Regarding the trailing slash ("first/example" vs. "second/example/"), RoundedBox will accept both alternatives but the first one is preferred. |
Image-FilePrefix |
Type: string
Default value: empty string
When RoundedBox searches for images, FilePrefix property specifies how the filenames begin. If they are named rounded_top.png, rounded_topleft.png etc., this property should be set to "rounded_". Empty string is a default value. |
Image-Separator |
Type: string
Default value: empty string
When RoundedBox searches for images, Separator specifies any string between vertical and horizontal portion of the filenames. If your files are named "prefix_vertical-horizontal.png", Separator should be se to "-". Empty string is a default value. |
Image-FileExtension |
Type: string
Default value: "png"
When RoundedBox searches for images, FileExtension specifies files extension. Defaults to "png" |
Image-NameForTop,
Image-NameForRight,
Image-NameForBottom,
Image-NameForLeft,
Image-NameForMiddle |
Type: string
Default values: "top", "right", "bottom", "left" and "middle"
When RoundedBox searches for images, these properties specify the naming conventions for file names. By default, RoundedBox expects something like "topleft.png". If your file is named e.g. "upperleft.png", you should set NameForTop to "upper". To save you some typing, you should care in mind that RoundedBox expects "top", "right", "bottom", "left" and "middle" by default so it is a good idea to create filenames that uses this convention. |
Image - summary example |
By default, RoundedBox seeks top left image on the path "~/topleft.png". If the images are in "rounded" directory, start with "rb_" and are separated by hyphen (e.g. "~/rounded/rb_top-left.png"), the properties should be set to
Image-Directory="~/rounded"
Image-FilePrefix="rb_"
Image-Separator="-"
All other properties fit with their default values. So it's a good idea to create images that containt "top", "left" etc. in their names. |
RoundedBox can be used to round any visible ASP.NET server control (yes, really!). Here's the procedure:
Prepared rounded box settings from skin file will then be applied to every ASP.NET server control containing the appropriate RoundedBoxSkinID property. If the RoundedBoxSkinID is present but the value is an empty string, skin file is searched for RoundedBox definition without SkinID property set.