ASP.NET Hosting

RoundedCorners and StyledPanel web controls

Scott Mitchell created a WebControl named RoundedCorners. Its goal is to simplify the creation of rounded boxes in your dynamic web pages.
Let's quote Scott:

Creating a box with rounded corners isn't terribly difficult, and there's a myriad of ways for creating such design elements. Virtually all of the techniques, though, require using Photoshop or some other graphics editing program to create rounded corners of the appropriate color. For graphics designers, creating rounded corners must be extremely boring, and they likely hold as much interest in creating rounded corners as veteran ASP.NET developers do in creating a connection to a database. Been there, done that - thousands of times. But for non-graphics designers (like yours truly), creating these rounded corners can be frustratingly slow and annoying, especially if you're like me, and the only graphics editing program you have is Microsoft Paint.

To overcome this loathsome activity, I decided to create a custom ASP.NET server control that would utilize the dynamic image-creation capabilities of GDI+ to create the corner images for me. The result is an ASP.NET Web control, which I call RoundedCorners, that you can drop on an ASP.NET Web page, set a few properties, and be presented with a nifty box with rounded corners, as shown on the right.

The most up to date version of this control allows you to drag and drop controls into the control, just like with the standard Panel.

I recommand this control in case you want a simple rounded box. In cases where you want something more fancy and don't mind playing with a picture editor, you can use my old StyledPanel WebControl.
The source code is quite simple (one class, a few lines), and the control supports composition too, which means you can drag&drop controls from VS' ToolBox into the control.

Something you may want to do is upgrade this control to a templated one. This would let you specify separate content for the header of the control, and for the body, for example. Creating templated web controls is explained by Scott Mitchell himself.

1 Comment

Comments have been disabled for this content.