単語が認識された場合、テキストボックスの内容のいくつかの単語を別のフォームへのクリック可能なリンクに変換したいと考えています。それは可能ですか?
1 に答える
0
認識された単語かどうかを確認するために、変更されるたびにテキストボックスの値を確認していただけますか? 認識された単語である場合は、テキストのスタイルを設定し (青色で下線を引く)、ブール変数 ( clickable
) を true に設定できます。次に、イベントで、が trueClick
かどうかを確認し、イベントを処理する場合に確認します。clickable
boolean textbox1Clickable = false;
public void textbox1_TextChanged(object sender, EventArgs e)
{
string s = textbox1.Text;
if(TextIsARecognizedWord(s))
{
//set the fore color of textbox1 to blue
//set the font style of textbox1 to underlined
textbox1Clickable = true;
}
else
{
//set the fore color of textbox1 to black
//set the font style of textbox1 to normal (not underlined)
textbox1Clickable = false;
}
}
public void textbox1_Click(object sender, System.EventArgs e)
{
if(textbox1Clickable)
{
//open your other form based on what is in textbox1.Text
}
}
それとも、テキストボックスを実際に入力できないリンクに変えたいですか?
于 2013-06-07T17:55:57.543 に答える