Home     About PeterBlum.com     Policies     Download a Licensed Product     Newsletter
SpacerImage  
Current Release: 1.0.1  Release History
Jump to: Syntax Example | Download

Most web sites employ a "spacer", a 1x1 pixel white image file that is used to form gaps between other objects simply by using this text:
<img src="spacer.gif" width=[gapwidth] height=[gapheight] />
While it's easy to enter this each time, your User Controls and distributed Custom Controls may also need a spacer. Normally, they'll each need to be set up with a path to the image file. It would be easier to have a common path used by all custom controls.

The web control SpacerImage builds the standard HTML code for spacers. Plus it defines its path to the spacer file globally, in the SpacerImage.xGlobalImageURL static property. Start using SpacerImage in place of other ways to write the spacer. Then assign the image file once, on SpacerImage.xGlobalImageURL when your application starts up. Every custom control that uses SpacerImage benefits from this.

Hopefully, Microsoft will adapt this idea into a future release of the .Net Framework so every programmer uses it automatically.

ASP.NET Syntax Example

Here are two examples of the ASP.NET Syntax. One uses the default size of a 1 x 1 pixel area. The second stretches the image into 5 x 10 pixels. Notice that lack of the file name. This control automatically uses a globally defined URL to the image file. It defaults to /aspnet_client/spacer.gif.

<spc:SpacerImage id=SI1 runat=server />
<spc:SpacerImage id=SI2 runat=server Width=5px Height=10px />

Download

Product SpacerImage
Version 1.0 (Current release: 1.0.1)
Price Free
Restricted Usage Unrestricted. A donation to the .Net development community. However, it is distributed "AS IS".
Source Code Included
Language C#
Compatibility Microsoft .Net 1.0 and 1.1
Installation You will download a Zip file named SpacerControl.zip. Extract its contents. It will place all files into a folder named SpacerControl.
Documentation Once installed, read the file Documentation.rtf in WordPad or a word processor for instructions on how to compile the control and connect it to your ASP.NET web application.
The source code is also documented.

Download this file