Imports System.Web.UI
Imports System.ComponentModel
Imports System.Web.UI.WebControls
Imports System.Text
Imports System.Web
Namespace FlashAdRotatorNamespace FlashAdRotator.Web.UI.WebControls
<DefaultProperty "Text"), ToolboxData "<{0}:FlashAdRotator runat=server></{0}:FlashAdRotator>")> _
Public Class FlashAdRotatorClass FlashAdRotator
Inherits System.Web.UI.WebControls.AdRotator
Private isFlashAD As Boolean
Private ImgUrl As String
Private NavUrl As String
’/ <summary>
’/ 将此控件呈现给指定的输出参数。
’/ </summary>
’/ <param name="output"> 要写出到的 HTML 编写器 </param>
Protected Overrides Sub Render )Sub Render ByVal writer As System.Web.UI.HtmlTextWriter)
If Me.isFlashAD Then
Dim StringFormat As StringBuilder = New StringBuilder "<object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" ")
StringFormat.Append "codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"" width={0} height={1}>")
StringFormat.Append " <param name=""movie"" value={2}>")
StringFormat.Append " <param name=""quality"" value=""high"">")
StringFormat.Append " <embed src={3} quality=""high"" ")
StringFormat.Append " pluginspage=""http://www.macromedia.com/go/getflashplayer"" type=""application/x-shockwave-flash""></embed></object>")
Dim OutPutString As StringBuilder = New StringBuilder
’ OutPutString.AppendFormat StringFormat.ToString, Me.Width, Me.Height, Me.ResolveUrl StringUnit.CombineURL Me.AdvertisementFile, Me.ImgUrl)), Me.ResolveUrl StringUnit.CombineURL Me.AdvertisementFile, Me.ImgUrl)))
OutPutString.AppendFormat StringFormat.ToString, Me.Width, Me.Height, Me.ImgUrl, Me.ImgUrl)
writer.Write OutPutString.ToString)
Else
MyBase.Render writer)
End If
End Sub
Protected Overrides Sub OnAdCreated )Sub OnAdCreated ByVal e As AdCreatedEventArgs)
MyBase.OnAdCreated e)
If e.ImageUrl.ToLower ).IndexOf ".swf") <> -1 Then
Me.isFlashAD = True
Me.ImgUrl = e.ImageUrl
Me.NavUrl = e.NavigateUrl
Else
Me.isFlashAD = False
End If
End Sub
End Class
Public Class FlashAdRotatorDesigner
Inherits System.Web.UI.Design.WebControls.AdRotatorDesigner
End Class ’FlashAdRotatorDesigner
|