phpover一般热衷于开机相关内容,当然还有像蓝屏,C#,javascript,摩托罗拉...之类的他也关注.
就在最近他刚刚提了一个有关C#的问题:
咨询一个richTextBox设置字体颜色
我有一个richTextBox,里面内容如下:标题:XXXXXXX.........XXXXXXX内容:XXXXXXX......XXXXXXX我想让“标题:”和“内容”变成红色怎么写啊!我用richTextBox1.Select(0,3);richTextBox1.SelectionColor = Color.Red;结果所有的都变成红色了 如是有个RichtextBox1去显示类似QQ的聊天
phpover也喜欢解答或者评论一些内容,比如最近他刚刚回复了其他网友的内容:
对于haixizi38的Listbox滚动条定位问题?回复到
你可以这样最后让我们再度感谢下phpover对本站和网友们的贡献,他于2010年加入我们,一直关注和支持我们的发展,感谢!!
完整源代码
<%@ Page Language= "C# " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<script runat= "server ">
void ListBox1_SelectedIndexChanged( object sender, EventArgs e )
{
string js = " <script> " + System.Environment.NewLine;
for (int i = ListBox1.Items.Count - 1 ; i > 0 ; i--)
{
if (ListBox1.Items[i].Selected)
js += "document.getElementById( ' " + ListBox1.ClientID + " ').options[ " + i.ToString() + "].selected=true; " + i.ToString() + System.Environment.NewLine;
}
js += " </s " + "cript> " + System.Environment.NewLine; Page.RegisterStartupScript( "js ", js);
}
</script>
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head runat= "server ">
<title> 无标题页 </title>
</head>
<body>
<form id= "form1 " runat= "server ">
<asp:ListBox ID= "ListBox1 " runat= "server " AutoPostBack= "True " OnSelectedIndexChanged= "ListBox1_SelectedIndexChanged "
SelectionMode= "Multiple " Width= "200px ">
<asp:ListItem> 11 </asp:ListItem>
<asp:ListItem> 22 </asp:ListItem>
<asp:ListItem> 33 </asp:ListItem>
<asp:ListItem> 44 </asp:ListItem>
<asp:ListItem> 55 </asp:ListItem>
<asp:ListItem> 66 </asp:ListItem>
<asp:ListItem> 77 </asp:ListItem>
<asp:ListItem> 88 </asp:ListItem>
<asp:ListItem> 99 </asp:ListItem>
<asp:ListItem> 110 </asp:ListItem>
<asp:ListItem> 111 </asp:ListItem>
<asp:ListItem> 211 </asp:ListItem>
<asp:ListItem> 222 </asp:ListItem>
<asp:ListItem> 233 </asp:ListItem>
<asp:ListItem> 244 </asp:ListItem>
<asp:ListItem> 255 </asp:ListItem>
<asp:ListItem> 266 </asp:ListItem>
<asp:ListItem> 277 </asp:ListItem>
<asp:ListItem> 288 </asp:ListItem>
<asp:ListItem> 299 </asp:ListItem>
<asp:ListItem> 210 </asp:ListItem>
<asp:ListItem> 2111 </asp:ListItem>
</asp:ListBox>
</form>
</body>
</html>