Skip to content

Commit 40dd779

Browse files
authored
Fix FlatStyle drawing of ComboBox (#6505)
1 parent 358f9a3 commit 40dd779

File tree

2 files changed

+0
-46
lines changed

2 files changed

+0
-46
lines changed

src/System.Windows.Forms/src/System/Windows/Forms/ComboBox.FlatComboAdapter.cs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
using System.Drawing;
66
using System.Windows.Forms.Layout;
7-
using static Interop;
8-
using static Interop.User32;
97

108
namespace System.Windows.Forms
119
{
@@ -185,48 +183,6 @@ protected virtual Color GetPopupOuterBorderColor(ComboBox comboBox, bool focused
185183

186184
protected virtual Color GetInnerBorderColor(ComboBox comboBox)
187185
=> comboBox.Enabled ? comboBox.BackColor : SystemColors.Control;
188-
189-
/// <summary>
190-
/// This eliminates flicker by removing the pieces we're going to paint ourselves from the update region.
191-
/// Note the UpdateRegionBox is the bounding box of the actual update region. This is here so we can
192-
/// quickly eliminate rectangles that aren't in the update region.
193-
/// </summary>
194-
public unsafe void ValidateOwnerDrawRegions(ComboBox comboBox, Rectangle updateRegionBox)
195-
{
196-
if (comboBox is null)
197-
{
198-
return;
199-
}
200-
201-
Rectangle topOwnerDrawArea = new Rectangle(0, 0, comboBox.Width, _innerBorder.Top);
202-
Rectangle bottomOwnerDrawArea = new Rectangle(0, _innerBorder.Bottom, comboBox.Width, comboBox.Height - _innerBorder.Bottom);
203-
Rectangle leftOwnerDrawArea = new Rectangle(0, 0, _innerBorder.Left, comboBox.Height);
204-
Rectangle rightOwnerDrawArea = new Rectangle(_innerBorder.Right, 0, comboBox.Width - _innerBorder.Right, comboBox.Height);
205-
206-
if (topOwnerDrawArea.IntersectsWith(updateRegionBox))
207-
{
208-
RECT validRect = new RECT(topOwnerDrawArea);
209-
ValidateRect(comboBox, &validRect);
210-
}
211-
212-
if (bottomOwnerDrawArea.IntersectsWith(updateRegionBox))
213-
{
214-
RECT validRect = new RECT(bottomOwnerDrawArea);
215-
ValidateRect(comboBox, &validRect);
216-
}
217-
218-
if (leftOwnerDrawArea.IntersectsWith(updateRegionBox))
219-
{
220-
RECT validRect = new RECT(leftOwnerDrawArea);
221-
ValidateRect(comboBox, &validRect);
222-
}
223-
224-
if (rightOwnerDrawArea.IntersectsWith(updateRegionBox))
225-
{
226-
RECT validRect = new RECT(rightOwnerDrawArea);
227-
ValidateRect(comboBox, &validRect);
228-
}
229-
}
230186
}
231187
}
232188
}

src/System.Windows.Forms/src/System/Windows/Forms/ComboBox.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3915,8 +3915,6 @@ protected override void WndProc(ref Message m)
39153915
RECT updateRegionBoundingRect = default;
39163916
Gdi32.GetRgnBox(windowRegion, ref updateRegionBoundingRect);
39173917

3918-
FlatComboBoxAdapter.ValidateOwnerDrawRegions(this, updateRegionBoundingRect);
3919-
39203918
// Call the base class to do its painting (with a clipped DC).
39213919
bool useBeginPaint = m.WParamInternal == 0;
39223920
using var paintScope = useBeginPaint ? new BeginPaintScope(Handle) : default;

0 commit comments

Comments
 (0)