PavelTorgashov / FastColoredTextBox

Fast Colored TextBox for Syntax Highlighting. The text editor component for .NET.
Other
1.21k stars 463 forks source link

Autocomplete menu doesn't render items #186

Closed tomdam closed 4 years ago

tomdam commented 4 years ago

Hi Pavel,

I'm struggling with Autocomplete menu for some time. I use it to show methods and properties of a class, similar to your AutocompleteSample3 sample and it works fine most of the time. But sometimes it renders the white box without any text for items. The items are still there, since I can click and select them and the tooltips are shown for them (it's like the white box is rendered over the items). This morning I downloaded the latest version of FCTB source from the github, started the AutocompleteSample3 and got the same result as in my application.

image

Do you have any idea what might be causing this and if there is a way we can handle it? Thanks in advance!

tomdam commented 4 years ago

I found the solution for this problem. There were two issues. First one is the fact that AdjustScroll() method is being called from OnPaint method, which was at some situations changing the Size of the control during the OnPaint execution (if the number of autocomplete items was different than before) and it was causing the OnPaint to be called again. That was causing the control to have strange behaviour shown on image in my original post.

The other issue was causing a little bit different, but also strange behaviour. At some situations, when Autocomplete control had a visible scrollbar during one display, and less items and no scrollbar during the next display, it was sometimes cutting a part of the control. The issue can be seen on the next two images. before fix: image

after fix: image

Pull request for this has been created.