我在C#.net(使用visual studio)製作工作簿創作者linkbutton style
本書是從文本部分和問題部分構建的。
該問題的所有答案都在文本的旁邊,用戶需要點擊正確的答案。 如果他是對的,那麼這個詞變成綠色,如果他錯了,它會變成紅色。
我使用linkbutton爲此,我需要它沒有和「鏈接」風格。
我用這個代碼的問題部分:
public class question
{
public void createQusetion(Panel leftside, string text, string question,string answer)
{
string[] Qbuttonstext = text.Split(' ');
for (int i = 0; i < Qbuttonstext.Length; i++)
{
LinkButton answerButton = new LinkButton();
if (Qbuttonstext[i] == answer)
{
answerButton.ID = "answer";
}
else
{
answerButton.ID = "word" + i.ToString();
}
answerButton.Text = Qbuttonstext[i].ToString()+" ";
answerButton.CssClass = "textbuttonB4";
answerButton.Click += new EventHandler(checkAnswer);
leftside.Controls.Add(answerButton);
}
}
}
我用CSS樣式表,並使用此代碼:
.textbuttonB4 a:link
{
style:none;
color:Black;
font-size:18px;
border-bottom-style:none;
background-color:transparent;
text-decoration: none;
}
.textbuttonB4 a:hover
{
style:none;
color:Black;
font-size:18px;
border-bottom-style:none;
background-color:transparent;
text-decoration: none;
}
.textbuttonB4 a:visited
{
style:none;
color:Black;
font-size:18px;
border-bottom-style:none;
background-color:transparent;
text-decoration: none;
}
運行時的文字代碼仍然顯示爲鏈接。
尋找解決方案後,不知道爲什麼它不工作。
對於此問題的以前版本感到抱歉。
asaf
你的問題不會解釋你正在使用哪些工具。另外,「由於某種原因,它不起作用」並沒有告訴我們什麼。 – 2012-02-26 15:21:17
我同意彌敦道。請添加一個測試用例或提供更多信息。 – 2012-02-26 15:23:23
對不起,我改變了這個問題。 謝謝 – 2012-02-26 16:26:04