例如有一个COMBOBOX控件
with combo1
  for i=0 to 99
     .additem i+1,i
   next i
end with 如果我想让这个下拉列表中的1——20的颜色是红色的,剩余的是另外一个颜色?
该怎么写?谢谢

解决方案 »

  1.   

    Private Sub Combo1_Click()
    Text1.Text = Combo1.Text
    If Text1.Text < 20 Then  ' If Combo1.Text < 20
      Combo1.BackColor = vbRed
      Else
      Combo1.BackColor = vbGreen
    End If
    End Sub
      

  2.   

    Private Sub Combo1_Click()
    'Text1.Text = Combo1.Text
    If Combo1.Text < 21 Then  ' If Combo1.Text < 20
      Combo1.BackColor = vbRed
      Else
      Combo1.BackColor = vbGreen
    End If
    End Sub
      

  3.   

    laviewpbt(人一定要靠自己)
    怎么定义子类?能说的清楚点吗?
      

  4.   

    Combo6.itemData(Combo6.NewIndex) = QBColor(12)
    重新定义COMBOBOX控件下拉框中字体的颜色,这个为什么不行?
    调用QBColor函数前面还要引用什么吗?
      

  5.   

    这个我觉得只有一个办法,那就是扩展COMBOBOX控件的类,生成子类,然后重载几个函数。我没有用过vb,但是好像vb也有类的概念。