该死的代码
三聪的博客
摘要: #region -- 流操作 /// /// 复制流 /// public static MemoryStream CopyStream(Stream stream) { MemoryStream ms... 阅读全文
posted @ 2014-04-30 10:06 三聪 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 如果你乐意,当然可以使用强大的第三方类库Json.Net中的JObject类解析复杂Json字串 。我不太希望引入第三方类库,所以在.Net内置类JavaScriptSerializer.DeserializeObject的基础上做了一些封装,可以方便的读取复杂json中的内容,而无需专门定义对应的类型。等不及看的,直接下载源码: JsonObject.7z(2013-08-29更新,第三版)代码实例:namespace JsonUtils{ class Program { static void Main(string[] args) { ... 阅读全文
posted @ 2013-08-28 09:57 三聪 阅读(7540) 评论(13) 推荐(2) 编辑
摘要: /// <summary> /// 制作等比环切缩缩图 /// </summary> public static bool MakeThumbnail(Image image, string savePath, int toWidth, int toHeight) { if (File.Exists(savePath)) { File.SetAttributes(savePath, FileAttributes.Normal); File.Delete(savePath); } ... 阅读全文
posted @ 2013-03-01 13:21 三聪 阅读(323) 评论(0) 推荐(0) 编辑
摘要: 在写js时经常会使用到无参或固定参数方法,比如window.setTimeout(func,300) 比如$("input").click(func)等如果我们需要定时执行的一个参多个参数方法,应该如果处理呢?比如有这样一个方法:function log(a, b){ console.log(a + "_" + b);}我们需要定时400毫秒后执行直接用log方法是行不通的:window.setTimeout(log,100); //错误的我们首先想到可行的方法:window.setTimeout(function(){log(1,2)},100);再来 阅读全文
posted @ 2013-02-19 14:42 三聪 阅读(9141) 评论(8) 推荐(4) 编辑
摘要: CREATEFUNCTION[dbo].[RandInt](@GuidValueasuniqueidentifier)RETURNSintASBEGINdeclare@strasvarchar(10)set@str=left(@GuidValue,8)declare@iasintdeclare@numberasintset@i=0set@number=0while(@i<8)beginset@number=@number+(Ascii((substring(@str,@i+1,1)))*Power(10,@i))set@i=@i+1endreturn@numberEND 阅读全文
posted @ 2011-09-16 17:01 三聪 阅读(408) 评论(0) 推荐(0) 编辑
摘要: stringfile=files[i];Imageimg=Image.FromFile(file);intwidth=img.Width;intheight=img.Height;if(width>height){width=800;height=width*img.Height/img.Width;}else{height=800;width=height*img.Width/img.Height;}Bitmapbt=newBitmap(width,height);Graphicsg=Graphics.FromImage(bt);g.DrawImage(img,0,0,width,he 阅读全文
posted @ 2011-07-13 14:11 三聪 阅读(209) 评论(0) 推荐(0) 编辑
摘要: winform提供皮 privatevoidForm1_Load(objectsender,EventArgse){Externalext=newExternal(this);webBrowser1.ObjectForScripting=ext;}}[System.Runtime.InteropServices.ComVisibleAttribute(true)]publicclassExternal{Formform;publicExternal(Formform){this.form=form;}publicvoidwappFullScreen(boolflag){if(flag){for 阅读全文
posted @ 2011-06-29 23:43 三聪 阅读(406) 评论(0) 推荐(0) 编辑
摘要: 方法一:1//#region--文本框TextArea光标相关2varPos={3//IE版本号4getIEVer:function(){5varmatch=navigator.appVersion.match(/MSIE\s+\d+.0;/);6if(match==null)return-1;7return+match[0].match(/\d+/)[0];8},9getPos:function(textBox){10if(document.selection){11varrange=document.selection.createRange();12varrange_all=docume 阅读全文
posted @ 2011-06-14 10:57 三聪 阅读(1373) 评论(2) 推荐(0) 编辑
摘要: ie下:var doc=document.getElementById("frame1").contentWindow.document;alert(x.getElementById('xxx'));非ie下(标准script)var doc=document.getElementById("frame1").contentDocument;alert(x.getElementById('xxx'));如果就jquery就可以兼容了var doc=$("#frame1").contents();aler 阅读全文
posted @ 2011-05-03 15:48 三聪 阅读(282) 评论(0) 推荐(0) 编辑
摘要: stringchars="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";privatevoidbutton1_Click(objectsender,EventArgse){inti=int.Parse(textBox1.Text);textBox2.Text=EncodeNum(i);textBox3.Text=DecodeNum(textBox2.Text).ToString();}///<summary>///转码///</summary>///<paramn 阅读全文
posted @ 2011-03-30 10:40 三聪 阅读(315) 评论(0) 推荐(0) 编辑

作者:gateluck
出处:http://gateluck.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。