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 s_offsetPixels = comboBox.LogicalToDeviceUnits(OFFSET_2PIXELS); _clientRect = comboBox.ClientRectangle; int dropDownButtonWidth = SystemInformation.GetHorizontalScrollBarArrowWidthForDpi(comboBox._deviceDpi); _outerBorder = new Rectangle(_clientRect.Location, new Size(_clientRect.Width - 1, _clientRect.Height - 1)); _innerBorder = new Rectangle(_outerBorder.X + 1, _outerBorder.Y + 1, _outerBorder.Width - dropDownButtonWidth - 2, _outerBorder.Height - 2); _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); // fill in several pixels of the dropdown rect with white so that it looks like the combo button is thinner. if (smallButton) { _whiteFillRect = _dropDownRect; _whiteFillRect.Width = WhiteFillRectWidth; _dropDownRect.X += WhiteFillRectWidth; _dropDownRect.Width -= WhiteFillRectWidth; } _origRightToLeft = comboBox.RightToLeft; if (_origRightToLeft == RightToLeft.Yes) { _innerBorder.X = _clientRect.Width - _innerBorder.Right; _innerInnerBorder.X = _clientRect.Width - _innerInnerBorder.Right; _dropDownRect.X = _clientRect.Width - _dropDownRect.Right; _whiteFillRect.X = _clientRect.Width - _whiteFillRect.Right + 1; // since we're filling, we need to move over to the next px. } }