Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ internal class FlatComboAdapter
private const int OFFSET_2PIXELS = 2;
protected static int s_offsetPixels = OFFSET_2PIXELS;

private bool SmallButton { get; }

public FlatComboAdapter(ComboBox comboBox, bool smallButton)
{
// adapter is re-created when combobox is resized, see IsValid method, thus we don't need to handle DPI changed explicitly
Expand All @@ -35,6 +37,8 @@ public FlatComboAdapter(ComboBox comboBox, bool smallButton)
_innerInnerBorder = new Rectangle(_innerBorder.X + 1, _innerBorder.Y + 1, _innerBorder.Width - 2, _innerBorder.Height - 2);
_dropDownRect = new Rectangle(_innerBorder.Right + 1, _innerBorder.Y, dropDownButtonWidth, _innerBorder.Height + 1);

SmallButton = smallButton;

// fill in several pixels of the dropdown rect with white so that it looks like the combo button is thinner.
if (smallButton)
{
Expand All @@ -46,7 +50,7 @@ public FlatComboAdapter(ComboBox comboBox, bool smallButton)

_origRightToLeft = comboBox.RightToLeft;

if (_origRightToLeft == RightToLeft.Yes)
if (smallButton && _origRightToLeft == RightToLeft.Yes)
{
_innerBorder.X = _clientRect.Width - _innerBorder.Right;
_innerInnerBorder.X = _clientRect.Width - _innerInnerBorder.Right;
Expand All @@ -67,6 +71,11 @@ public virtual void DrawPopUpCombo(ComboBox comboBox, Graphics g)
return;
}

if (SmallButton)
{
DrawFlatCombo(comboBox, g);
}

bool rightToLeft = comboBox.RightToLeft == RightToLeft.Yes;

// Draw a dark border around everything if we're in popup mode
Expand Down