comboBox控件写一段代码,怎么写啊?下拉列表的内容怎么出来?

2025-02-24 10:57:37
推荐回答(1个)
回答1:

if ComboBox1.Text='宋体' then
Richedit1.SelAttributes.Name:='宋体'
else if ComboBox1.Text='微软雅黑'then
Richedit1.SelAttributes.Name:='微软雅黑'
else if ComboBox1.Text='楷体'then
Richedit1.SelAttributes.Name:='楷体'
else if ComboBox1.Text='幼圆'then
Richedit1.SelAttributes.Name:='幼圆'
else if ComboBox1.Text='方正喵呜体'then
Richedit1.SelAttributes.Name:='方正喵呜体'
else if ComboBox1.Text='黑体'then
Richedit1.SelAttributes.Name:='黑体'
else
Richedit1.SelAttributes.Name:='宋体'

combobox1.text为获取当前选择的值 我这段代码是做一个类似于WORD的程序设置字体用得,你可以参照下。

另外,在下拉框里的值你可以在combobox的属性items中设置。。。