gpt4 book ai didi

c# - 如何使图像随着浏览器大小的动态变化而自动调整大小?

转载 作者:行者123 更新时间:2023-11-28 09:52:01 25 4
gpt4 key购买 nike

我有一个在后端创建的图表,然后作为图像传递到前端。当我更改浏览器的窗口大小时,我需要此图像缩小/增大,但无法使其适应屏幕大小。任何人都知道如何让它随着浏览器窗口大小的变化自动调整大小?

equip.cshtml:

<img src="@Url.Action("DrawChart")" alt="Drawing chart with HTML Helper" />

装备.cs

public ActionResult DrawChart()
{
var chart = new Chart(width: 450, height: 300)
.AddSeries(
chartType: "Doughnut",
xValue: new[] { "10 Records", "20 Records", "30 Records", "40 Records" },
yValues: new[] { "50", "60", "78", "80" })
.GetBytes("png");

return File(chart, "image/bytes");
}

最佳答案

我认为我们需要一个响应式设计...

我刚刚给出了关于在更改屏幕尺寸时调整图像大小的答案

查看 Making background images responsive - fullpage.js

关于c# - 如何使图像随着浏览器大小的动态变化而自动调整大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25046793/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com