将文本框与图像关联 [英] associate textbox with images

查看:106
本文介绍了将文本框与图像关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将文本框中的输入文本与图像相关联.
例如,如果我在文本框中输入字母"A",则会显示一个苹果图像,称为"A.jpg".如果我在文本框中输入字母"B",则图像可能是一个球,称为"B.jpg".如果文本框包含文本"ABC",它会同时显示在与这些字母相关的一系列三个图像中.

I need to associate the input text in textbox with images.
For example, if I put in the textbox the letter "A" it displays an image of an apple, which is called "A.jpg". If I put in the textbox the letter "B", an image may be a ball, which is called "B.jpg". If the textbox contains the text "ABC" it displayed simultaneously in a series of three images associated with those letters.

推荐答案

这听起来有点像作业问题. br/>
如果有可能使用除TextBox之外的其他东西,在我看来,CheckedListBox会是一个更好的选择.

可以这样做吗?
This sounds a bit like a homework question.

If there is any possibility of using something other than a TextBox, it seems to me that a CheckedListBox would be a better option.

Is there any possibility of doing that?


试试这个

使自动发回文本框= true
然后在文本框的textbinding事件上编写函数
在页面上放置图像控件以显示图像.

私有无效文本绑定(对象发送者,eventargs e)
{
imagecontrol.url = textbox.text +.jpg";

}

希望这能解决您的问题.
Try this

make auto post back of the textbox = true
and then on textbinding event of the textbox write the function
put an image control on the page to show the image.

private void textbinding(object sender, eventargs e)
{
imagecontrol.url = textbox.text+".jpg";

}

hope this solves your question.


这篇关于将文本框与图像关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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