This is a custom user control I wrote from scratch. To use
this user control, you
must first compile the vb file as an assembly. Run this
command to compile
DropShadow.vb into a DLL:
vbc /t:library /r:System.dll /r:System.Web.dll DropShadow.vb
Copy the DropShadow.dll into your web application's bin
directory. Then create
the web form below. The first line in the aspx file registers
the user control and
provides the name of its Assembly (i.e. DropShadow.dll). This
method avoids the
need for an ascx file with its own code-behind file. The
DropShadowControl features
various properties that you can set in its tag. You can set the
number of shadows,
the
shadow color, etc. In the DropShadow.vb source code, the
Description and
Category
tag before a property definition provides Visual Studio.NET with
information
for its
Property window.
<%@ Register TagPrefix="RR" Namespace="RobbinsControls" Assembly="DropShadow" %>
<%@ Page Language="vb" AutoEventWireup="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Drop Shadow Test</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<RR:DropShadowControl runat="server" Font-Name="Candy" Size="50" TextColor="#FF0000"
ShadowColor="#0000FF" Top="50" Left="6" Text="Robert Robbins" id="DropShadowControl1">
</RR:DropShadowControl>
</form>
</body>
</HTML>
DropShadow.vb
Imports System.ComponentModel
Imports System.Web.UI
Namespace RobbinsControls
Public Class DropShadowControl
Inherits System.Web.UI.WebControls.WebControl
Public Sub New()
Viewstate("Text") = "Text"
Viewstate("Size") = 20
Viewstate("ShadowColor") = "#C0C0C0"
Viewstate("TextColor") = "#000000"
Viewstate("NumberOfShadows") = 4
Viewstate("Top") = 6
Viewstate("Left") = 6
End Sub
<Description("Sets the Text for the drop shadow effect."), _
Category("Layout")> _
Public Property Text() As String
Get
Return CType(Viewstate("Text"), String)
End Get
Set(ByVal Value As String)
Viewstate("Text") = Value
End Set
End Property
<Description("Sets the size of the Text in pt."), _
Category("Misc")> _
Public Property Size() As Integer
Get
Return CType(Viewstate("Size"), Integer)
End Get
Set(ByVal Value As Integer)
Viewstate("Size") = Value
End Set
End Property
<Description("Sets the color of the shadows."), _
Category("Misc")> _
Public Property ShadowColor() As String
Get
Return CType(Viewstate("ShadowColor"), String)
End Get
Set(ByVal Value As String)
Viewstate("ShadowColor") = Value
End Set
End Property
<Description("Sets the color of the text."), _
Category("Misc")> _
Public Property TextColor() As String
Get
Return CType(Viewstate("TextColor"), String)
End Get
Set(ByVal Value As String)
Viewstate("TextColor") = Value
End Set
End Property
<Description("Sets the number of shadows."), _
Category("Misc")> _
Public Property NumberOfShadows() As Integer
Get
Return CType(Viewstate("NumberOfShadows"), Integer)
End Get
Set(ByVal Value As Integer)
Viewstate("NumberOfShadows") = Value
End Set
End Property
<Description("Sets the absolute top position."), _
Category("Misc")> _
Public Property Top() As Integer
Get
Return CType(Viewstate("Top"), Integer)
End Get
Set(ByVal Value As Integer)
Viewstate("Top") = Value
End Set
End Property
<Description("Sets the absolute left position."), _
Category("Misc")> _
Public Property Left() As Integer
Get
Return CType(Viewstate("Left"), Integer)
End Get
Set(ByVal Value As Integer)
Viewstate("Left") = Value
End Set
End Property
Protected Overrides Sub RenderContents(ByVal writer As HtmlTextWriter)
MyBase.RenderContents(writer)
writer.WriteLine("<style type=""text/css"">")
writer.WriteLine(".text {")
writer.WriteLine(" position: absolute; ")
writer.WriteLine(" top: " & CType(Viewstate("Top"), Integer) & "px;")
writer.WriteLine(" left: " & CType(Viewstate("Left"), Integer) & "px;")
writer.WriteLine(" font-size: " & CType(Viewstate("Size"), Integer) & "pt;")
writer.WriteLine(" color: " & CType(Viewstate("TextColor"), String) & ";")
writer.WriteLine("}")
Dim i As Integer
For i = 1 To CType(Viewstate("NumberOfShadows"), Integer)
writer.WriteLine(".shadow" & i & " {")
writer.WriteLine(" position: absolute;")
writer.WriteLine(" top: " & CType(Viewstate("Top"), Integer) - i & "px;")
writer.WriteLine(" left: " & CType(Viewstate("Left"), Integer) - i & "px;")
writer.WriteLine(" font-size: " & CType(Viewstate("Size"), Integer) & "pt;")
writer.WriteLine(" color: " & CType(Viewstate("ShadowColor"), String) & ";")
writer.WriteLine("}")
Next
writer.WriteLine("</style>")
writer.WriteLine("<p>")
For i = 1 To CType(Viewstate("NumberOfShadows"), Integer)
writer.WriteLine("<p class=""shadow" & i & """>" & CType(Viewstate("Text"), String) & "</p>")
Next
writer.WriteLine("<p class=""text"">" & CType(Viewstate("Text"), String) & "</p>")
End Sub
End Class
End Namespace
Example of output