当前位置: 移动技术网 > IT编程>开发语言>.net > ASP.NET取得所有颜色值示例

ASP.NET取得所有颜色值示例

2017年12月12日  | 移动技术网IT编程  | 我要评论

贾潇雨,黄记煌丑闻不断上黑榜,北方工业大学是几本

(1)怎样将电脑里有可用字体加入winform中的combobox中:
一句话搞定:combobox1.items.addrange (fontfamily.families);

(2)取得所有可用颜色并填充到asp.net的下拉菜单中:
复制代码 代码如下:

propertyinfo[] properties;
arraylist colors;
color color;
// solidbrush brush;
properties = typeof (color).getproperties (bindingflags.public | bindingflags.static);
colors = new arraylist ();
foreach (propertyinfo prop in properties)
{
// get the value of this static property
color = (color) prop.getvalue (null, null);
// skip colors that are not interesting
if (color == color.transparent) continue;
if (color == color.empty) continue;
try
{
ddllist.items.add(prop.name);
}
catch
{
}
// create a solid brush of this color
//brush = new solidbrush (color);
//colors.add (brush);
}

(3)怎样取得数据库的连接字符串?
a. 新建一个文本文件,文件名使用*.udl(比如:mydb.udl),此时发现图标变成数据库连接的图标了。
b. 双击此文件,弹出数据连接属性的对话框,此时你可以进行设置了。一般地,我们首先选择“提供程序”的选项卡,进行设置之后,再设置“连接”选项卡的相关属性,其他的我就不说了。设置好之后,最后按“确定”。可能会有相应的提示,你自己看着办吧。
c. 用记事本打开你刚才的这个文件。里面有类似这样的字符串:
provider=sqloledb.1;password=123456sa;persist security info=true;user id=sa;initial catalog=zpweb;data source=myservername
如果使用sqlserver数据库,将provider=sqloledb.1;改为:server=localhost;即可。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网