Projects

Find all our projects in development below.
All source code is GNU General Public License (GPL)

javaSpy

Browsing clsHTMLStyles.vb (3.58 KB)

Option Explicit On

Public Class clsHTMLStyles

    Private _scriptingObj As Object = Nothing
    Private _htmlElement As Object = Nothing
    Private _styleNames() As String = { _
        "background", _
        "backgroundAttachment", _
        "backgroundColor", _
        "backgroundImage", _
        "backgroundPosition", _
        "backgroundPositionX", _
        "backgroundPositionY", _
        "backgroundRepeat", _
        "border", _
        "borderBottom", _
        "borderBottomColor", _
        "borderBottomStyle", _
        "borderBottomWidth", _
        "borderColor", _
        "borderLeft", _
        "borderLeftColor", _
        "borderLeftStyle", _
        "borderLeftWidth", _
        "borderRight", _
        "borderRightColor", _
        "borderRightStyle", _
        "borderRightWidth", _
        "borderStyle", _
        "borderTop", _
        "borderTopColor", _
        "borderTopStyle", _
        "borderTopWidth", _
        "borderWidth", _
        "clear", _
        "clip", _
        "color", _
        "cursor", _
        "display", _
        "filter", _
        "font", _
        "fontFamily", _
        "fontSize", _
        "fontStyle", _
        "fontVariant", _
        "fontWeight", _
        "height", _
        "left", _
        "letterSpacing", _
        "lineHeight", _
        "listStyle", _
        "listStyleImage", _
        "listStylePosition", _
        "listStyleType", _
        "margin", _
        "marginBottom", _
        "marginLeft", _
        "marginRight", _
        "marginTop", _
        "overflow", _
        "padding", _
        "paddingBottom", _
        "paddingLeft", _
        "paddingRight", _
        "paddingTop", _
        "pageBreakAfter", _
        "pageBreakBefore", _
        "pixelHeight", _
        "pixelLeft", _
        "pixelTop", _
        "pixelWidth", _
        "position", _
        "posHeight", _
        "posLeft", _
        "posTop", _
        "posWidth", _
        "styleFloat", _
        "textAlign", _
        "textDecoration", _
        "textDecorationBlink", _
        "textDecorationLineThrough", _
        "textDecorationNone", _
        "textDecorationOverline", _
        "textDecorationUnderline", _
        "textIndent", _
        "textTransform", _
        "top", _
        "verticalAlign", _
        "visibility", _
        "width", _
        "wordSpacing", _
        "zIndex" _
    }

    Public Sub New(ByVal htmlElement As Object)

        _scriptingObj = CreateObject("MSScriptControl.ScriptControl")
        _htmlElement = htmlElement

        With _scriptingObj
            .Language = "VBScript"
            .AllowUI = False
            .AddObject("elementObj", _htmlElement)
        End With

    End Sub

    Public ReadOnly Property HtmlElement() As Object
        Get
            Return _htmlElement
        End Get
    End Property

    Public ReadOnly Property Styles() As ArrayList
        Get
            Return New ArrayList(_styleNames)
        End Get
    End Property

    Public Property Style(ByVal styleName As String) As String
        Get
            Return _scriptingObj.Eval("elementObj.style." + styleName)
        End Get
        Set(ByVal value As String)

            Try
                _scriptingObj.AddCode("function setStyle()" + vbCrLf + "elementObj.style." + styleName + " = """ + value + """" + vbCrLf + "end function")
                _scriptingObj.Eval("setStyle()")
                _scriptingObj.Reset()
            Catch
            End Try

        End Set
    End Property

End Class

Download clsHTMLStyles.vb

Back to file list


Back to project page