zoukankan      html  css  js  c++  java
  • C#修改SVG图片显示大小

            private void Main()
            {
                if (File.Exists(_svgFile))
                {
                    SetSvgSize(_svgFile, spnWidth.Value, spnHeight.Value);
                }
            }
    
            private void SetSvgSize(string file,decimal width,decimal height)
            {
                XmlDocument xml = new XmlDocument();
                xml.Load(file);
                var node = xml.DocumentElement;
                UpdateAttribute(node, "width", width.ToString());
                UpdateAttribute(node, "height", height.ToString());
                xml.Save(file);
            }
    
            private void UpdateAttribute(XmlNode node,string attrName,string value)
            {
                var atts = node.Attributes;
                for (int i = 0; i < atts.Count; i++)
                {
                    if (atts[i].Name.Equals(attrName,StringComparison.CurrentCultureIgnoreCase))
                    {
                        atts[i].Value = value;
                        return;
                    }
                }
                XmlAttribute tmp = node.OwnerDocument.CreateAttribute(attrName);
                tmp.Value = value;
                node.Attributes.Append(tmp);
            }
  • 相关阅读:
    机器学习数据
    偏差和方差
    numpy基础
    卷积神经网路
    深度学习基础
    Iris数据集
    SVM-SVR
    Java之日期处理
    MySQL笔记
    在Eclipse中运行的时候出现launching/Building
  • 原文地址:https://www.cnblogs.com/honk/p/14461266.html
Copyright © 2011-2022 走看看