简体   繁体   中英

WebBrowser object content changes position when form is minimized and then restored

I've written a C# app that uses a webbrowser for its main content window. The program loads a rather large amount of text into that browser, which works fine. I've noticed when reading that content, however, that if I minimize the application and then restore it that the position jumps way up in the text instead of remaining where it was. Doing this several times puts the text at the top of the content.

Any ideas what could cause this and what I could do to stop this behavior? It's only when I minimize/restore, if I alt-tab into another application and go back the position is properly retained.

Here are screenshots of the content: Before minimizing: http://imageshack.us/a/img641/9632/beforeminimize.jpg After restore: http://imageshack.us/a/img827/439/afterrestore.jpg

Here is a link to the code on GitHub, though I haven't changed any properties of the WebBrowswer aside from its anchors: https://github.com/benroth/FanBook

I think you can try the below steps:

  1. Open Windows form in design mode.
  2. Select Web Browser Control > Goto > Properties.
  3. Specify [Dock] property to None.
  4. In code behind, specify the height and width for the Web Browser Control.

I do have the similar problem and got fixed following the above steps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM