How do I use a label to display a complete SVG image?

Source: Internet
Author: User
Show

In HTML, it looks better to display svg,<object> than <embed>, because when the SVG size is too large,,<object> will only scale, and <embed> will crop the image off

Is the so-called: both Raw Yu, He Senliang. But <object> is a more informal label than <embed>!

If your SVG needs to be seen by more people, then using <embed> is a good choice!

It's simple, we can read the width,height! from SVG.

Because SVG is also in XML format, it is much easier!

<%@ import namespace= "System.Xml"%> don't forget to import the appropriate namespaces

The method is as follows: The role of the corresponding function I do not elaborate, the. NET Framework has a detailed description
Sub Showsvgwindow (Thesvgpath as String)
Dim reader As XmlTextReader = Nothing
Dim nodeattribtion As New ArrayList ()
Dim i,width,height As Integer

reader = new XmlTextReader (server. MapPath (Thesvgpath))
Dim exp As Exception

Try
While reader. Read ()
If Reader. NodeType = XmlNodeType.Element and reader. Name = "svg" Then
If Reader. HasAttributes Then
For i = 0 to (reader.attributecount-1)
Reader.movetoattribute (i)
If Reader. Name = "width" Then
width = reader. Value
End If
If Reader. Name = "height" Then
Height = reader. Value
End If
Next
End If
Exit while
End If
End While
Catch EXP

End Try

If CInt (width) < Then
width = "50"
Else If CInt (height) < Then
Height = "50"
End If
Svgwindow.text = "<embed src=" & Thesvgpath & "height=" & height & "px width=" & Width & PX&G T;</embed> "
Svgtitle.text = Request. QueryString ("title")
End Sub




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.