c# - Link to file path with space in Richtextbox -
i using richtextbox in winforms. have show links in richtextbox set readonly. works fine links out spaces
\\efile\dsc_0618.jpg
but when file has space
\\2527 threshold.png
it wont work , link broke due space.
i have used solution mentioned in link link file's path spaces in richtextbox?
but problem escape sequence displayed in richtextbox according that.
is there way can make link without using escape sequence?
i've found link http://www.codeproject.com/cs/miscctrl/richtextboxlinks.asp can insert link of text richtextbox
. there special note how fetch linktext
, link url
here doesn't seem found in original demo. here i'll demonstrate link info fetching in linkclicked
event handler:
//insert link test richtextboxex1.insertlink("stackoverflow", "http://www.stackoverflow.com"); //lickclicked event handler private void richtextboxex1_linkclicked(object sender, system.windows.forms.linkclickedeventargs e) { string[] s = e.linktext.split(new string[]{@"#http://"}, stringsplitoptions.none); if (s.length == 2) { s[1] = "http://" + s[1]; messagebox.show("a link has been clicked.\nthe link text '" + s[0] + "'\nthe link url '" + s[1] + "'"); system.diagnostics.process.start(s[1]);//try visiting link. } }
i think beautiful solution (and others have same problem).
Comments
Post a Comment