开发者

How do I paste richtext into a textbox?

开发者 https://www.devze.com 2022-12-26 20:14 出处:网络
I want to highlight some stuff on a web page and be able to paste it into a richtextbox in C# winforms. I want to then b开发者_如何学Pythone able to see the HTML code of what I had pasted.Is this poss

I want to highlight some stuff on a web page and be able to paste it into a richtextbox in C# winforms. I want to then b开发者_如何学Pythone able to see the HTML code of what I had pasted. Is this possible?


This snippet will return a string containing the code. There is some header info at the top that you may want to parse out but it is pretty straight forward.

string html = Clipboard.GetData(DataFormats.Html).ToString();

You will be able to populate that into a text box or richtext box however you like.

0

精彩评论

暂无评论...
验证码 换一张
取 消