-1

我创建了一个模型和一个视图,并使用简单的 GameController 从模型中显示了一些需要的数据。

现在我正在搜索(没有找到任何有用的东西)如何获取 9 张图像并使用 ApiController(9 张可用于拼图的图像)在页面中显示它们并修改 GameController 返回的页面,而不加载整个页。

这个想法是我想从 ApiController 调用该方法 9 次,并在网格/表格或某处显示图像。

我可以举一个例子来说明如何做到这一点,因为我没有在谷歌上找到相关的东西,而且有知识的人可以很快地做到这一点。

如果有什么不清楚的,就问吧。

谢谢,加布里埃尔萨斯

4

1 回答 1

1

这里有一个例子:

public HttpResponseMessage GetImage()
{
    HttpResponseMessage response = new HttpResponseMessage();
    response.Content = new StreamContent(new FileStream(@"path to image")); // this file stream will be closed by lower layers of web api for you once the response is completed.
    response.Content.Headers.ContentType = new MediaTypeHeaderValue("image/png");

    return response;
}
于 2013-04-22T20:49:12.427 回答