在vb.net中,如何设置colorDialog显示特定自定义颜色方案?
- 内容介绍
- 文章标签
- 相关推荐
本文共计207个文字,预计阅读时间需要1分钟。
在WinForms和VB.NET中,您不能直接在ColorDialog的默认自定义颜色框架中设置特定的自定义颜色。MSDN没有覆盖这个功能。问题是,这不是通过Color对象完成的 - 您需要处理BGR设置的值 - 即每一点。
是否有可能在 winforms,vb.net中定义将出现在colordialog的自定义颜色框中的特定自定义颜色? 简而言之,是的. MSDN覆盖它 here.问题是它不是通过Color完成的 – 你需要处理BGR设置的值 – 即每个整数由颜色组成00BBGGRR,所以你左移蓝色16,绿色8 ,并使用红色“按原样”.我的VB糟透了,但在C#中添加紫色:
using (ColorDialog dlg = new ColorDialog()) { Color purple = Color.Purple; int i = (purple.B << 16) | (purple.G << 8) | purple.R; dlg.CustomColors = new[] { i }; dlg.ShowDialog(); }
反射器向我保证这类似于:
Using dlg As ColorDialog = New ColorDialog Dim purple As Color = Color.Purple Dim i As Integer = (((purple.B << &H10) Or (purple.G << 8)) Or purple.R) dlg.CustomColors = New Integer() { i } dlg.ShowDialog End Using
本文共计207个文字,预计阅读时间需要1分钟。
在WinForms和VB.NET中,您不能直接在ColorDialog的默认自定义颜色框架中设置特定的自定义颜色。MSDN没有覆盖这个功能。问题是,这不是通过Color对象完成的 - 您需要处理BGR设置的值 - 即每一点。
是否有可能在 winforms,vb.net中定义将出现在colordialog的自定义颜色框中的特定自定义颜色? 简而言之,是的. MSDN覆盖它 here.问题是它不是通过Color完成的 – 你需要处理BGR设置的值 – 即每个整数由颜色组成00BBGGRR,所以你左移蓝色16,绿色8 ,并使用红色“按原样”.我的VB糟透了,但在C#中添加紫色:
using (ColorDialog dlg = new ColorDialog()) { Color purple = Color.Purple; int i = (purple.B << 16) | (purple.G << 8) | purple.R; dlg.CustomColors = new[] { i }; dlg.ShowDialog(); }
反射器向我保证这类似于:
Using dlg As ColorDialog = New ColorDialog Dim purple As Color = Color.Purple Dim i As Integer = (((purple.B << &H10) Or (purple.G << 8)) Or purple.R) dlg.CustomColors = New Integer() { i } dlg.ShowDialog End Using

