[英]When I try to show an image on linklabel click, I get an error
When I try to show an image on linklabel click, I get an error: unrecognized escape sequence. 当我尝试在linklabel单击上显示图像时,出现错误:无法识别的转义序列。
Code: 码:
public void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(
"mspaint~C:\Users\Joshua Banks\Desktop\Downtown_atlanta_night.jpg");
}
You need to escape the \\ chararacters in your string (the image path) by either escaping them with another \\ or using a verbatim string. 您需要通过用另一个\\转义或使用逐字字符串来转义字符串(图像路径)中的\\字符。
escape characters: 转义字符:
System.Diagnostics.Process.Start("mspaint~C:\\Users\\Joshua Banks\\Desktop\\Downtown_atlanta_night.jpg");
verbatim string literal: 逐字字符串文字:
System.Diagnostics.Process.Start(@"mspaint~C:\Users\Joshua Banks\Desktop\Downtown_atlanta_night.jpg");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.