Skip to content

Commit

Permalink
Fixed position of bounding rectangle for ComboBox items when drop dow…
Browse files Browse the repository at this point in the history
…n shows a scrollbar (#4354)
  • Loading branch information
SergeySmirnov-Akvelon authored Dec 14, 2020
1 parent a4fa8f9 commit cb03d37
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ public override Rectangle Bounds
{
ChildAccessibleObject listAccessibleObject = _owningComboBox.ChildListAccessibleObject;
int currentIndex = GetCurrentIndex();
if (_owningComboBox.IsHandleCreated)
{
int firstVisibleIndex = (int)(long)User32.SendMessageW(_owningComboBox, (User32.WM)User32.CB.GETTOPINDEX);

// Using the first visible index, we make an index shift, which helps to draw a rectangle with the correct position
currentIndex -= firstVisibleIndex;
}

Rectangle parentRect = listAccessibleObject.BoundingRectangle;
int left = parentRect.Left;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cb03d37

Please sign in to comment.