SVG图像元素和Asp.NET [英] SVG Image elements and Asp.NET

查看:70
本文介绍了SVG图像元素和Asp.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SVG和ASP.NET.我有一些定义为SVG的图像元素.基于一些操作,我想从后面的asp.net代码更改SVG图像的路径.

I am working with SVG and ASP.NET. I have some image elements defined as SVGs. Based on some manipulation, I want to change the path of SVG images from asp.net code behind.

我是SVG的新手.有人可以告诉我如何在后面的代码中访问SVG图像并执行所需的操作.高度赞赏有关SVG和asp.net的任何其他指南.

I am new to SVG. Can some tell me how can I access SVG images in code behind and perform the desired operations. Any other guidance regarding SVG and asp.net would be highly appreciated.

这是我的Web形式的svg标记:

This is my svg markup in web form:

<svg width="600" height="500">
    <rect x="10" y="10" height="250" width="500" style="fill:rgb(255, 255, 255);stroke-width:3;stroke:rgb(0,0,0)" />
    <image x="20" y="50" width="300" height="80"
           xlink:href="http://dely.com/Svg/images/Layout/top-bar-logo.png" />
    <image x="15" y="125" width="300" height="80"
           xlink:href="http://dely.com/Svg/images/Layers/left-bar.png" />
</svg>

推荐答案

我没有发现任何问题,只需添加 runat ="server" 并使用属性属性:

I don't see any problem by simply adding runat="server" and modifying URL from the code behind by using Attributes property:

<svg width="600"  height="500">
        <rect x="10" y="10" height="250" width="500" style="fill:rgb(255, 255, 255);stroke-width:3;stroke:rgb(0,0,0)" />

        <image runat="server" id="imgTest" x="20" y="50" width="300" height="80" 
            xlink:href="http://dely.com/Svg/images/Layout/top-bar-logo.png" />
        <image x="15" y="125" width="300" height="80"
            xlink:href="http://dely.com/Svg/images/Layers/left-bar.png" />

    </svg>

隐藏代码(我放置了新的测试URL):

Code Behind (I placed new test URL):

imgTest.Attributes.Add("xlink:href", "http://icons.iconarchive.com/icons/aha-soft/free-3d-glossy-interface/64/accept-icon.png");

这篇关于SVG图像元素和Asp.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆