asp.net取得所有颜色值的方法

  本节内容:

  asp.net获取颜色值的方法

  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;即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值