列表框问题是否更改字体C#WFA或将图像添加到列表框,该列表框在文本框和列表框中包含相同的文本? [英] Listbox problem change font C# WFA or add image to listbox which contains same text in textbox and listbox?
本文介绍了列表框问题是否更改字体C#WFA或将图像添加到列表框,该列表框在文本框和列表框中包含相同的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我有一个文本框,一个按钮和一个列表框...我想这样做:当我向文本框添加一些文本,并且该文本在列表框中存在时,想要更改字体并在列表框中将该项目加粗...有人可以帮我吗??
或这样:我想在文本框中匹配的文本框中添加绿点???
Hello
I have one textbox, one button and one listbox... I want to do this: When i add some text into textbox, and that text is allrady existing in listbox, a want to change font and bold that item in listbox... Can someone help me????
Or this: I want to add green dot to text in listbox which are matching in textbox???
private void button1_Click(object sender, EventArgs e)
{
if (listBox1.Items.Contains(textBox1.Text) == false)
{
listBox1.Items.Add(textBox1.Text);
}
else
{
MessageBox.Show("It's allrady in listbox");
//need to change font and bold that item in listbox
//or add green dot to text in listbox
}
}
推荐答案
真是巧合!甚至我都在学习如何更改字体.在WPF中如此容易实现,但在Windows窗体中则需要更多的努力.
但是,我发现了一个可能对您有帮助的链接(也对我有帮助!):
http://social.msdn.microsoft.com/论坛/en-US/Vsexpressvcs/thread/b09c5c20-4b5f-4d42-954c-e4383b2bf0ec [
What a coincidence! Even I was learning how to change the font. Its so easy to do in WPF but in Windows Forms it requires more effort.
However I found a link which might help you(and help me too!):
http://social.msdn.microsoft.com/forums/en-US/Vsexpressvcs/thread/b09c5c20-4b5f-4d42-954c-e4383b2bf0ec[^]
Good luck! :thumbsup:
这篇关于列表框问题是否更改字体C#WFA或将图像添加到列表框,该列表框在文本框和列表框中包含相同的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文