|
#Region "Copyright (c) Justin Carasick. All rights reserved"
'--------------------------------------------------------------------------
' <copyright>Copyright (c) Justin Carasick. All rights reserved.</copyright>
' <author>Justin Carasick</author>
' <contact>jcarasick@gmail.com</contact>
'--------------------------------------------------------------------------
#End Region
Imports System.web.UI.HtmlTextWriter
Imports System.Web.UI
Imports System.Web.UI.Design
Imports System.ComponentModel
Imports System.Drawing.Design
Imports System.Drawing
Imports System.Design
Imports System.Windows.Forms
<Designer(GetType(VMLControlDesigner)), ToolboxData("<{0}:VMLLine runat=server></{0}:VMLLine>")> Public Class VMLLine
Inherits VMLControl
Implements INamingContainer
Sub New()
MyBase.ButtonText = "Draw Line"
End Sub
Private _LineStyle As New VMLLineStyle
<Category("Appearance"), _
Description("Defines The Line Stroke Style"), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Content), _
TypeConverter(GetType(ExpandableObjectConverter))> _
Public Property LineStyle() As VMLLineStyle
Get
Return _LineStyle
End Get
Set(ByVal Value As VMLLineStyle)
_LineStyle = Value
End Set
End Property
Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
'Stream the Javascript
Page.RegisterStartupScript("VMLScript", "<script language=""javascript""> " & HelperFunctions.ReadJavasript & " </script>")
MyBase.Render(output)
End Sub
Protected Overrides Sub AddAttributesToRender(ByVal output As System.Web.UI.HtmlTextWriter)
Dim cursorString As String
If Me.CustomCursorEnabled Then
cursorString = "url(" & Me.CustomCursor.ToString.ToLower & ")"
Else
cursorString = Me.CursorStyle.ToString
End If
Select Case Me.ButtonType
Case ButtonTypeEnum.Button
output.AddAttribute(HtmlTextWriterAttribute.Type, "button")
output.AddAttribute(HtmlTextWriterAttribute.Onclick, "activate('" & Me.ID & "','" & Me.BoundingDrawCanvas & "','LINE','" & cursorString & "')")
output.AddAttribute(HtmlTextWriterAttribute.Value, Me.ButtonText)
Case ButtonTypeEnum.Image
output.AddAttribute(HtmlTextWriterAttribute.Type, "image")
output.AddAttribute(HtmlTextWriterAttribute.Onclick, "activate('" & Me.ID & "','" & Me.BoundingDrawCanvas & "','LINE','" & cursorString & "'); return false;")
output.AddAttribute(HtmlTextWriterAttribute.Src, Me.ImageSrc.Replace("\", "/"))
output.AddAttribute("onmouseout", "this.src='" & Me.ImageSrc.Replace("\", "/") & "';")
'Add Mouseover & MouseDown Images
If Not Me.ImageSrcMouseOver.Equals(String.Empty) Then
output.AddAttribute("onmouseover", "this.src='" & Me.ImageSrcMouseOver.Replace("\", "/") & "';")
End If
If Not Me.ImageSrcMouseDown.Equals(String.Empty) Then
output.AddAttribute("onmousedown", "return false; this.src='" & Me.ImageSrcMouseDown.Replace("\", "/") & "';")
End If
End Select
MyBase.AddAttributesToRender(output)
End Sub
Protected Overrides Sub RenderChildren(ByVal output As System.Web.UI.HtmlTextWriter)
'Create The VML Tag
Dim outTags As New System.Text.StringBuilder
outTags.Append("<v:line ID=" & Quote(Me.ID) & " ")
Dim cursorString As String
If Me.CustomCursorEnabled Then
cursorString = Me.CustomCursor
outTags.Append("style=" & DoubleQuoteChar & "z-index: 1004;cursor: url('" & cursorString & "');" & DoubleQuoteChar & " >")
Else
cursorString = Me.CursorStyle.ToString
outTags.Append("style='cursor: " & cursorString & ";z-index: 1004;'>")
End If
outTags.Append(Me.LineStyle.StrokeTag)
outTags.Append("</v:line>")
output.Write(outTags.ToString)
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
University of Florida graduate in Geography. Currently pursuing a Master of Science in Management Information Systems.
Go Gators!