【问题标题】:vb.net creating a square to show a color selected by a color dialogvb.net 创建一个正方形以显示由颜色对话框选择的颜色
【发布时间】:2013-04-22 01:45:20
【问题描述】:

我想要一个小方块来显示颜色对话框当前选择的颜色。

应该是这样的:Picture of what I want

当他们选择一种颜色时,绿色框应该更新为另一种颜色。 我该怎么做呢?

【问题讨论】:

    标签: vb.net colordialog


    【解决方案1】:
    Using colorDialog As New ColorDialog
        'If the user actually selected a color Then
        If colorDialog.ShowDialog() = DialogResult.OK Then
            'Set the background color of the picture box = color selected from the color dialog
            PictureBox1.BackColor = colorDialog.Color
        End If
    End Using
    

    将此代码放在您的Button_Click 事件处理程序中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-12-30
      • 2018-09-28
      • 1970-01-01
      • 1970-01-01
      • 2014-05-08
      • 2012-06-20
      • 1970-01-01
      相关资源
      最近更新 更多