【问题标题】:draw line on image without save image on server ASP .net在图像上画线而不在服务器 ASP .net 上保存图像
【发布时间】:2017-10-09 15:41:02
【问题描述】:

如何使用后面的 c# 代码在 asp 页面上的特定坐标上的图像上绘制水平线 这是我在 aspx 页面中的图像代码

 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
 <!--Content Here-->

    <asp:Image ID="Image1"  runat="server" Width="900" Height="650" />

</ContentTemplate>

</asp:UpdatePanel>

谁能帮帮我

【问题讨论】:

  • 你的代码在哪里?

标签: c# asp.net image


【解决方案1】:

你可以使用下面的代码来画线:

public void DrawLineInt(Bitmap bmp)
{
    Pen blackPen = new Pen(Color.Black, 3);

    int x1 = 100;
    int y1 = 100;
    int x2 = 500;
    int y2 = 100;
    // Draw line to screen.
    using(var graphics = Graphics.FromImage(bmp))
    {
       graphics.DrawLine(blackPen, x1, y1, x2, y2);
    }
}

参考这个:how to draw a line on a image?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-04-24
    • 2014-06-17
    • 1970-01-01
    • 2020-04-03
    • 2011-07-09
    • 2017-01-26
    • 2020-11-22
    • 2011-12-14
    相关资源
    最近更新 更多