如何使messabox的backColor成为我的ComboBox中选择的颜色 [英] How to make the backColor of a messabox the color selected in my ComboBox

查看:80
本文介绍了如何使messabox的backColor成为我的ComboBox中选择的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我制作了自定义颜色选择器并制作了一个组合框,因此颜色的名称会显示在其中,如何在组合框中选择颜色后显示消息框



此外我试图将这种颜色存储到带有插入的数据库中,无论如何都要这样做





下面是我在ComboBox中显示颜色的代码





Hi I have make a Custom Color Picker and made a combo box so the names of the colors appear in it, how can I make a messagebox appear after selecting the color in the combobox

Also im trying to store that color into the databse with an insert is there anyway to do it


Below is my code for displaying the colors in the ComboBox


Private Sub frmRegAsam_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      'load de colores'
      Dim ColorList As New ArrayList()
      Dim colorType As Type = GetType(System.Drawing.Color)
      Dim propInfoList As PropertyInfo() = colorType.GetProperties(BindingFlags.[Static] Or BindingFlags.DeclaredOnly Or BindingFlags.[Public])
      For Each c As PropertyInfo In propInfoList
          Me.cboVotante.Items.Add(c.Name)
          Me.cboSuplente.Items.Add(c.Name)
      Next

  End Sub

推荐答案

1。使用组合框选择索引更改事件来捕获事件。

2.创建名为显示颜色的函数

3.函数DisplayColor应显示一个新窗体,背景设置为组合框选择值



创建自己的表单比使用消息框对象更容易。



如果要将所选值保存到数据库,则只需将添加到组合框中的颜色名称插入表中。



我假设您需要其他字段,例如userid,以获取用户首选项。
1. Use the combobox selected index change event to trap the event.
2. Create function called display color
3. Function DisplayColor should display a new form with the background set to the combobox selected value

It will be easier to create your own form rather use a messagebox object.

If you want to save the selected values to the database then just insert into a table the colorname you added to the combobox.

I am assuming you need other fields in there like userid perhaps, to fetch user preferences.


这篇关于如何使messabox的backColor成为我的ComboBox中选择的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆