图像未从本地驱动器加载到应用程序中(Images not loading in application from a local drive)

编程入门 行业动态 更新时间:2024-10-17 07:35:50
图像未从本地驱动器加载到应用程序中(Images not loading in application from a local drive)

我有一个C#应用程序来显示图像。 我有以下代码,我想从本地驱动器显示如下:

img.src = "D:\abc.png";

但上面的代码没有呈现任何图像。 什么是正确的格式?

I have an C# application to display an image. I have the following code where I want to display from the local drive as follows:

img.src = "D:\abc.png";

But the above code is not rendering any image. What could be the correct format?

最满意答案

正如我评论你可以试试@

img.src = @"D:\abc.png";

因为\将被视为转义序列的开始。 避免它@会有所帮助

As I commented you can try with @

img.src = @"D:\abc.png";

because \ will consider as starting of a escape sequence. to avoid it @ will help

更多推荐

本文发布于:2023-08-07 14:47:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464545.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:驱动器   应用程序   图像   加载   Images

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!