.net - 更改组合框自动完成下拉列表的颜色
问题描述
我制作了一个自定义组合框用户控件。主要目的是在黑暗模式下渲染它。我已经设法实现了大部分。但是,我不知道如何修改自动完成下拉菜单(即应用前后颜色)。
这是问题所在:
我正在通过以下代码修改组合框渲染:
Protected Overrides Sub WndProc(ByRef m As Message)
MyBase.WndProc(m)
Select Case m.Msg
Case &HF
Dim g As Graphics = Me.CreateGraphics
' Full Control Background
g.FillRectangle(_BorderBrush, Me.ClientRectangle)
If Me.DropDownStyle = ComboBoxStyle.DropDown Then
g.FillRectangle(New SolidBrush(Me.BackColor), _BorderWidth, _BorderWidth,
Me.Width - _ButtonWidth - (3 * _BorderWidth),
Me.ClientRectangle.Height - (2 * _BorderWidth))
' DropDown Button Background
Dim rect As Rectangle = New Rectangle(Me.Width - _ButtonWidth - _BorderWidth, _BorderWidth,
_ButtonWidth, Me.Height - (2 * _BorderWidth))
g.FillRectangle(_DropButtonBrush, rect)
ElseIf Me.DropDownStyle = ComboBoxStyle.DropDownList Then
g.FillRectangle(New SolidBrush(Me.BackColor), _BorderWidth, _BorderWidth,
Me.Width - (2 * _BorderWidth),
Me.ClientRectangle.Height - (2 * _BorderWidth))
End If
' Drop Down BUtton Arrow
Dim pth As Drawing2D.GraphicsPath = New Drawing2D.GraphicsPath()
Dim TopLeft As PointF = New PointF(Me.Width - _ButtonWidth - _BorderWidth + 2, (Me.Height - 5) / 2)
Dim TopRight As PointF = New PointF(Me.Width - 6, (Me.Height - 5) / 2)
Dim Bottom As PointF = New PointF(Me.Width - 9, (Me.Height + 2) / 2)
pth.AddLine(TopLeft, TopRight)
pth.AddLine(TopRight, Bottom)
g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
g.FillPath(_ArrowBrush, pth)
Case Else
Exit Select
End Select
End Sub
我不完全理解 WndProc 过程,但我想知道是否还有其他代码用于自动完成下拉渲染?但是,不知道如何去寻找这些代码。
有任何想法吗?
解决方案
推荐阅读
- python - 如何访问将从未知数量的列表元素(jinja2)生成的 POST 数据
- typescript - 如何从 TypeScript 模块在全局对象上使用库(不导入它)?
- python-3.x - 使用 Scrapy、登录和 2FA 登录 Steam
- excel - 在 Excel 或电子表格中的其他函数中使用数据集之前,先在数据集上应用函数
- c# - 无法跟踪实体类型的实例,因为正在跟踪具有键值的另一个实例
- css - 在保持宽度的同时修复 IE11 中的 table thead
- node.js - 文件大小(6003804160)大于可能的缓冲区:节点中的 2147483647
- postgresql - 如何在 Rust 上使用 Actix 创建 POST 方法?
- json - 每 30 分钟将 Json 导入 Firebase 实时数据库
- css - 引导进度标签未完全显示