2007-11-24 | 冬日糊辣汤
关于WWF的安装方法:
在vs2005里安装WWF,必须要安装.net framework 3.0才可以,之所以要安装.net 3.0,他的框架包含workflow,.net 3.0已经包括了很多插件,已经升级很多功能。
在C#里使用My对象的方法:
My对象一直在VB里被使用,下面我们介绍一下My对象在C#里使用的方法:在打开一个项目后,在VS2005的项目里添加引用,在.net选项页选择“Microsoft.VisualBasic”命名空间,点“确定”添加引用,要注意一点的是在VS2003里会添加到Bin目录里,在VS2005里是将设置信息添加到Web.Config里.
然后在CS代码里需添加下列命名空间:
using Microsoft.VisualBasic.ApplicationServices;
using Microsoft.VisualBasic.Devices;
using Microsoft.VisualBasic.FileIO;
using Microsoft.VisualBasic.Logging;
using Microsoft.VisualBasic.MyServices;
相关命名空间的解释,可参考相关文档和资料。
具体应用实例,例如:
Microsoft.VisualBasic.Devices.Computer mycomputer= new Computer();
或 Computer mycomputer =new Computer();
要实现什么样的功能,添加什么命名空间就可以了,具体引用实例和上边雷同。
js或者其他语言中常用到的正则表达式:
1//整数"int":"^([+-]?)\\d+$",
2//正整数"int+":"^([+]?)\\d+$",
3//负整数"int-":"^-\\d+$",
4//数字"num":"^([+-]?)\\d*\\.?\\d+$",
5//正数"num+":"^([+]?)\\d*\\.?\\d+$"
6//负数"num-":"^-\\d*\\.?\\d+$",
7//浮点数"float":"^([+-]?)\\d*\\.\\d+$",
8//正浮点数"float+":"^([+]?)\\d*\\.\\d+$",
9//负浮点数"float-":"^-\\d*\\.\\d+$",
10//E-MAIL"email":"^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$",
11//颜色"color":"^#[a-fA-F0-9]{6}"
12//联接"url":"^http[s]?:\\/\\/([\\w-]+\\.)+[\\w-]+([\\w-. %&=]*)?$",
13//仅中文"chinese":"^[\\u4E00-\\u9FA5\\uF900-\\uFA2D]+$"
14//仅ACSII字符"ascii":"^[\\x00-\\xFF]+$"
15//邮编"zipcode":"^\\d{6}$"
16//手机"mobile":"^0{0,1}13[0-9]{9}$"
17//ip地址"ip4":"^\(([0-1]\\d{0,2})|(2[0-5]{0,2}))\\.(([0-1]\\d{0,2})|(2[0-5]{0,2}))\\.(([0-1]\\d{0,2})|(2[0-5]{0,2}))\\.(([0-1]\\d{0,2})|(2[0-5]{0,2}))$",
18//非空"notempty":"^\\S+$"
19//图片"picture":"(.*)\\.(jpg|bmp|gif|ico|pcx|jpeg|tif|png|raw|tga)$"
20//压缩文件"rar":"(.*)\\.(rar|zip|7zip|tgz)$"
21//日期"date":"^\\d{2,4}[\\/\\-]?((((0?[13578])|(1[02]))[\\/|\\-]?((0?[1-9]|[0-2][0-9])|(3[01])))|(((0?[469])|(11))[\\/|\\-]?((0?[1-9]|[0-2][0-9])|(30)))|(0?[2][\\/\\-]?(0?[1-9]|[0-2][0-9])))$",
22//时间"time":"^(20|21|22|23|[01]\\d|\\d)(([:.][0-5]\\d){1,2})$"
采用js限制上传图片的格式为JPG:
function mysubmit()
{ if(IUpload.picsrc.value =="")
{
alert("请点击浏览按钮,选择您要上传的JPG文件!");
IUpload.picsrc.focus; return (false);
}
else
{
str= IUpload.picsrc.value;
strs=str.toLowerCase();
lens=strs.length;
extname=strs.substring(lens-4,lens);
if(extname!=".jpg")
{
alert("请选择JPG的文件!");
return (false);
}
else
{
document.all("loadImg").src=IUpload.picsrc.value;
if(document.all("loadImg").offsetWidth!=240&&document.all("loadImg").offsetHeight! =320)
{
alert("您选择的图片大小:"+document.all("loadImg").offsetWidth+"*"+document.all ("loadImg").offsetHeight + "请选择240*320大小的图片");
return (false);
}
}
}
}


档案
日志
相册
视频





评论