How do I paste richtext into a textbox?
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.
精彩评论