上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 31 下一页
摘要: using System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;using System.Reflection;using System.Runtime.InteropServices;using System.Globalization;namespace GetCode{ public class MyWebBrowser : WebBrowser { private const int DISPID_AMBIENT_DLCONTROL = -5512; private i 阅读全文
posted @ 2012-12-05 14:01 天涯海客 阅读(724) 评论(0) 推荐(0) 编辑
摘要: File: Form1.cs Collapse | Copy Codeusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;using myCustomBrowser;namespace CustomBrowser{ [ComVisible(true)] ... 阅读全文
posted @ 2012-12-05 13:58 天涯海客 阅读(626) 评论(0) 推荐(0) 编辑
摘要: Visual C#两分钟搭建BHO IE钩子微软在1997年正式推出Browser Helper Object (BHO), 使程序员能够更好的对IE进行二次开发和操作. 在通过编写BHO程序数月后, 我希望把我的一些经验告诉才开始的同志, 避免走一些弯路.我本人是非常喜欢C++的. 因为C++对内存直接操作的方式可以节省非常多的内存损耗, 也更快一些. 但是在开发BHO的时候, 我的确也认识到, C#明显要比C++强大很多. 例如C#提供的FOREACH 循环就可以避免FOR循环产生的溢出. 另外C#的类型转换也明显要强于C++. 毕竟BHO和C#都是出自微软一家, 理所当然, C#更适合B 阅读全文
posted @ 2012-12-05 10:21 天涯海客 阅读(532) 评论(0) 推荐(0) 编辑
摘要: datagridview1.rows.add提供了4种方法,在委托的时候使用Add(DataGridViewRow),就可以成功委托添加了。之前用Add(Object[])委托但总是不行,抛出异常:参数计数不匹配。可能使用方法不对吧。委托方法:delegate int AddGridROW(DataGridViewRow i);//线程访问控件的委托,新建委托DataGridViewRow dgvr = new DataGridViewRow();//实例化对象dgvr.CreateCells(DataGridView1);//设置模板,映射作用dgvr.Cells[0].Value = &q 阅读全文
posted @ 2012-11-19 13:17 天涯海客 阅读(967) 评论(0) 推荐(0) 编辑
摘要: 1.使用SqlCommand.ExecuteReader()方法会造成窗体假死,所以用.net2.0新增的方法BeginExecuteReader代码如下:private delegate void DataGridViewHandler(DataTable dt); /// <summary> /// 此处开始加在数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> priv 阅读全文
posted @ 2012-11-17 18:17 天涯海客 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 最简单的代码publicclassClientEngine:SoapExtension{StreamoldStream;StreamnewStream;stringactionName;///<summary>///构造函数///</summary>publicClientEngine(){}publicoverrideobjectGetInitializer(LogicalMethodInfomethodInfo,SoapExtensionAttributeattribute){returnattribute;}publicoverrideobjectGetIniti 阅读全文
posted @ 2012-11-17 16:10 天涯海客 阅读(218) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Web.Services; using System.Web.Services.Protocols; using System.IO; namespace SunLibrary.Web { /* **********服务器端配置********** 在WebService项目中,增加Soap扩展有两种方式,web.config配置或WebMethod配置(推荐使用WebMethod方式只扩展必要的接口) 1.web.config配置将对所有WebMethod发生作用。!!但是,无法配置Attribute的自定义属性!! ... 阅读全文
posted @ 2012-11-17 15:56 天涯海客 阅读(540) 评论(0) 推荐(0) 编辑
摘要: C# Stream 和 byte[] 之间的转换一. 二进制转换成图片MemoryStream ms = new MemoryStream(bytes);ms.Position = 0;Image img = Image.FromStream(ms);ms.Close();this.pictureBox1.Image二. C#中byte[]与string的转换代码1、System.Text.UnicodeEncoding converter = new System.Text.UnicodeEncoding(); byte[] inputBytes =converter.GetBytes(i. 阅读全文
posted @ 2012-11-14 16:08 天涯海客 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 最近项目需要用到压缩,以前1.1的时候都用的第3方库,这次想尝试一下2.0带的 Compression库。一用发现这个库压的东西偏大,而且没文件名没时间。那么到底是为什么会这样呢,难道是我的使用有问题?决定要搞搞明白,于是有了下面这段代码,用SharpZipLib和2.0自带的库做下对比,大家都采用Gzip压缩使用2.0的库做压缩staticMemoryStreamDeflate(byte[]data)...{MemoryStreammemoryStream=newMemoryStream();using(GZipStreamgzip=newGZipStream(memoryStream,Co 阅读全文
posted @ 2012-11-14 14:49 天涯海客 阅读(1150) 评论(0) 推荐(0) 编辑
摘要: 在webservice中将dataset序列化是我们经常遇到的问题,但是遇到很大的dataset,则网络传输就必须考虑的问题,将dataset处理压缩后传输是我们不错的选择,下面提供这种方法:第一步:引入命名空间下载DataSetSurrogate组件using System.IO.Compression;using System.Runtime.Serialization.Formatters.Binary;将下载好的DataSetSurrogate放入bin路径下第二步:压缩序列化///序列化转化为二进制数组的DataSetpublic byte[] GetDataSetSurrogate 阅读全文
posted @ 2012-11-14 09:20 天涯海客 阅读(326) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 31 下一页