zoukankan      html  css  js  c++  java
  • C# WebApi生成SVG图

     1 public HttpResponseMessage CreateUserLogo(string realName)
     2 {
     3             var httpResponseMessage = new HttpResponseMessage(HttpStatusCode.OK)
     4             {
     5                 Content = new StringContent(
     6                 $"<svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 500 500" enable-background="new 0 0 500 500" xml:space="preserve" height="500px" width="500px"><rect width="500" height="500" fill="#A8F0A8"/><text x="50%" y="50%" dy=".3em" font-family="sans-serif" font-size="220px" text-anchor="middle" fill="#330000">{realName}</text></svg>", Encoding.UTF8)
     7             };
     8             httpResponseMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("image/svg+xml");
     9             httpResponseMessage.Content.Headers.ContentType.CharSet = "UTF-8";
    10             return httpResponseMessage;
    11 }

    效果图

  • 相关阅读:
    0 Explore TreeView
    按钮颜色选择器
    颜色组合框
    Get Files from Directory
    05.0 图片
    WINAPI 变量(2861个)
    为字符串增加50个空格
    让DataGridView显示行号
    相对路径
    SpecialFolder
  • 原文地址:https://www.cnblogs.com/zhuanjiao/p/13086199.html
Copyright © 2011-2022 走看看