0

I am currently using the control System.Windows.Forms.WebBrowser to create an Wysiwyg editor in a windows application. Basically what I need is that the text does not exceed the width of the control, ie I do not want to use a horizonal scrollbar.

Is it possible?

[UPDATE]

this is the code for the moment I am running:

 Reconocimiento.Navigate("about:blank"); //this is my object System.Windows.Forms.WebBrowser
 Reconocimiento.Document.OpenNew(false);
 string html = "<html><head><style type=\"text/css\">body {width: 400px;}</style></head><body></body></html>";
 Reconocimiento.Document.Write(html);
 recon = (Reconocimiento.Document.DomDocument) as IHTMLDocument2;
 recon.designMode = "On"; //What we just did was make our web browser editable!
Guillermo
  • 213
  • 3
  • 15
  • 1
    You used it to type this question. Did you see a horizontal scrollbar? – Hans Passant Dec 30 '11 at 00:42
  • 1
    did you look at the form designer to see what size is there and then modify it. – COLD TOLD Dec 30 '11 at 00:46
  • Hans: touche, how they do here in Stackoverflow. Now Cold: I'm thinking I should make active the vertical but not horizontal, and changing the width of the control that does not happen – Guillermo Dec 30 '11 at 00:56
  • Maybe i can use this [question](http://stackoverflow.com/questions/5496549/how-to-inject-css-in-webbrowser-control), but fails to use the method `createStyleSheet` – Guillermo Dec 30 '11 at 14:09
  • Sheng: as you can see above is the code I use, I'm not using an iframe – Guillermo Jan 02 '12 at 23:15
  • I also tested this [question](http://social.msdn.microsoft.com/forums/en-US/winforms/thread/6eb608f1-9a45-462b-a541-d5ad36ab5d7b/) – Guillermo Jan 02 '12 at 23:17

1 Answers1

0

You can make use of the css word-break property.

Create a file with the following contents and save it to say C:\default.html (or some application path)

<html>    
  <body style='word-break: break-all'>
  <body>
</html>

In you code, instead of navigating to about:blank, call

Reconocimiento.Navigate(new Uri("file:///C:/default.html"));
George
  • 1,508
  • 16
  • 13