黄聪

论SEO对人类的重要性,请看我的博客:hcsem.com

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2010年3月26日

摘要: > 纯文本方式> 打印///<summary>///CreatingaWatermarkedPhotographwithGDI+for.NET///</summary>///<paramname="rSrcImgPath">原始图片的物理路径</param>///<paramname="rMarkImgPath">水印图片的物理路径</param>///<paramname="rMarkText">水印文字(不显示水印文字设为空串)< 阅读全文
posted @ 2010-03-26 22:17 黄聪 阅读(3988) 评论(0) 推荐(0) 编辑

摘要: 今天,看到网友咨询DES加密的事,就写了下面的类库,sharing 一下,欢迎多交流Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->using System;using System.Collections.Generic;using System.Text;using System.IO;using System.Security;using System.Security.Cryptography;/*------------------ 阅读全文
posted @ 2010-03-26 18:41 黄聪 阅读(905) 评论(0) 推荐(0) 编辑

摘要: 1.新建一个控制台应用程序,保存在桌面上,Main函数如下所示Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { forea 阅读全文
posted @ 2010-03-26 17:13 黄聪 阅读(935) 评论(0) 推荐(0) 编辑

摘要: button2为子窗口的退出按钮,要退出全部程序,代码可以如下:private void button2_Click(object sender, EventArgs e){Application.Exit();System.Environment.Exit(0);this.Close();Application.ExitThread();} 阅读全文
posted @ 2010-03-26 15:52 黄聪 阅读(321) 评论(0) 推荐(0) 编辑

摘要: 本来我的机器装的是VS2005,后来有一个项目要用VC++6.0开发,没办法装上一个,项目完成后就给卸载了,不想原来的VS2005中C#的项目在Build时报以下警告:警告1“LIB 环境变量”中指定的搜索路径“D:\Microsoft Visual Studio\VC98\mfc\lib”无效 --“系统找不到指定的路径。 ”原来是在安装VC++6.0时,在环境变量里添加了一个叫“lib”的Administrator用户变量,清除上面提到的路径,重启VS2005 Build 项目,警告消失。具体操作如下:右键"我的电脑",在弹出的菜单中点击"属性"-& 阅读全文
posted @ 2010-03-26 15:50 黄聪 阅读(868) 评论(0) 推荐(0) 编辑

摘要: //添加xml节点 private voidAddXml(string image, string title) {XmlDocument xmlDoc = new XmlDocument();xmlDoc.Load(Server.MapPath("../flash/dati.xml"));XmlNode root =xmlDoc.SelectSingleNode("images");//查找<images>XmlElement xe1 =xmlDoc.CreateElement("thumb");//创建一个<th 阅读全文
posted @ 2010-03-26 15:49 黄聪 阅读(392) 评论(0) 推荐(0) 编辑

摘要: // C# 日期格式DateTime dt = DateTime.Now;dt.ToString();//2005-11-5 13:21:25dt.ToFileTime().ToString();//127756416859912816dt.ToFileTimeUtc().ToString();//127756704859912816dt.ToLocalTime().ToString();//2005-11-5 21:21:25dt.ToLongDateString().ToString();//2005年11月5日dt.ToLongTimeString().ToString();//13:2 阅读全文
posted @ 2010-03-26 15:48 黄聪 阅读(327) 评论(0) 推荐(0) 编辑

摘要: using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.OleDb;using System.Web;using System.Data.SqlClient;namespace 数据回滚{public partial class Form1 : Form{public 阅读全文
posted @ 2010-03-26 15:48 黄聪 阅读(1107) 评论(0) 推荐(0) 编辑

摘要: OleDbCommand cmd = new OleDbCommand("", conn);conn.Open();OleDbTransaction tran = conn.BeginTransaction();cmd.Transaction = tran;try{foreach (string sql in values){cmd.CommandText = sql;cmd.ExecuteNonQuery();}tran.Commit();return true;}catch (Exception){tran.Rollback();return false;//Messa 阅读全文
posted @ 2010-03-26 15:47 黄聪 阅读(412) 评论(0) 推荐(0) 编辑

摘要: void Button1Click(object sender, EventArgs e){//图片异步加载完成后的处理事件pictureBox1.LoadCompleted += new AsyncCompletedEventHandler(pictureBox1_LoadCompleted);//图片加载时,显示等待光标pictureBox1.UseWaitCursor = true;//采用异步加载方式pictureBox1.WaitOnLoad = false;//开始异步加载,图片的地址,请自行更换pictureBox1.LoadAsync("http://www.zu14 阅读全文
posted @ 2010-03-26 15:46 黄聪 阅读(3330) 评论(2) 推荐(1) 编辑

摘要: 今天写C#的时候无缘无故出现了 一个“已关闭 Safe handle”的错误,上网Google了一下,发现原来是SerialPort类引起的问题,原本的代码是设置好一个串口类后立刻打开了一个对话框,但此时就会跳出“已关闭 Safe handle”的错误,原本我以为是对话框里面的对象调用出现了问题,但是检查跟踪了好久也没找到问题所在,最后我在生成该对话框对象之前加入了SerialPort的关闭方法close后,问题就迎刃而解了. 阅读全文
posted @ 2010-03-26 15:46 黄聪 阅读(3492) 评论(0) 推荐(0) 编辑

摘要: 该实例功能为“多线程控制UI控件”,线程函数实现自动加1。界面如下:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Threading;namespace treadTest{ //定义委托 publicdelegate void ListBoxDelegate(); publicpartial clas 阅读全文
posted @ 2010-03-26 15:45 黄聪 阅读(617) 评论(0) 推荐(0) 编辑

摘要: 这只是一个微小的窗体特效,但有时也会有画龙点睛之效。using 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;namespace winForm{public partial class Form1 : Form{#region 窗体边框阴影效果变量申明const i 阅读全文
posted @ 2010-03-26 15:43 黄聪 阅读(5657) 评论(1) 推荐(1) 编辑

摘要: C# 文件操作文件操作: 检查 创建 读取 写入 修改 删除目录操作: 检查 创建 读取 写入 修改 删除--------------------------------------------------------------------------------文件操作若要执行此操作... 请参阅本主题中的示例...创建文本文件 向文件写入文本写入文本文件 向文件写入文本读取文本文件 从文件读取文本向文件中追加文本 File.AppendText FileInfo.AppendText重命名或移动文件 File.Move FileInfo.MoveTo删除文件 File.Delete Fi 阅读全文
posted @ 2010-03-26 15:41 黄聪 阅读(434) 评论(0) 推荐(0) 编辑

摘要: //获得图片Image bg = Image.FromFile("文件地址");//获得GraphicsGraphics g = CreateGraphics();//以图片中心为原点平移g.TranslateTransform(bg.Width/2 ,bgg.Height/2);//旋转度数int i = 60;g.RotateTransform(i);g.TranslateTransform(-bg.Width/2,-bgg.Height/2);//重置g.ResetTransform(); 阅读全文
posted @ 2010-03-26 15:41 黄聪 阅读(321) 评论(0) 推荐(0) 编辑

摘要: vs2005 打包,并自动安装SQL数据库2007年11月25日 星期日 16:51一).创建部署项目1.在“文件”菜单上指向“添加项目”,然后选择“新建项目”。2.在“添加新项目”对话框中,选择“项目类型”窗格中的“安装和部署项目”,然后选择“模板”窗格中的“安装项目”。在“名称”框中键入setup1。3.单击“确定”关闭对话框。4.项目被添加到解决方案资源管理器中,并且文件系统编辑器打开。5.在“属性”窗口中,选择ProductName属性,并键入信息管理系统。二).将主程序项目的输出添加到部署项目中1.在“文件系统编辑器”中,选择“应用程序文件夹”。在“操作”菜单上,指向“添加”,然后选 阅读全文
posted @ 2010-03-26 15:40 黄聪 阅读(525) 评论(0) 推荐(0) 编辑

摘要: this.Location=newSystem.Drawing.Point(Screen.PrimaryScreen.Bounds.Width-this.Width,Screen.PrimaryScreen.Bounds.Height-100);for(inti=0;i<Screen.PrimaryScreen.Bounds.Height;i++){this.Show();for(intj=0;j<1000000;j++);this.Location=newSystem.Drawing.Point(this.Location.X,Screen.PrimaryScreen.Bound 阅读全文
posted @ 2010-03-26 15:38 黄聪 阅读(467) 评论(0) 推荐(0) 编辑

摘要: 1、定义在Settings.settings文件中定义配置字段。把作用范围定义为:User则运行时可更改,Applicatiion则运行时不可更改。可以使用数据网格视图,很方便;2、读取配置值text1.text = Properties.Settings.Default.FieldName;//FieldName是你定义的字段3、修改和保存配置Properties.Settings.Default.FieldName = "server";Properties.Settings.Default.Save();//使用Save方法保存更改注意:当设置scope为User时他 阅读全文
posted @ 2010-03-26 15:37 黄聪 阅读(5982) 评论(0) 推荐(0) 编辑

摘要: #region - 拖拽功能实现Dll -[Description("使能拖拽功能.")][DllImportAttribute("user32.dll")]public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);[DllImportAttribute("user32.dll")]public static extern bool ReleaseCapture();#endregionpublic Form1(){this.M 阅读全文
posted @ 2010-03-26 15:37 黄聪 阅读(421) 评论(0) 推荐(0) 编辑

摘要: 最近一直在学水晶报表,一些基础知识觉得学了不少,可是还是觉得水晶报表的核心还没有学会!可是是在自学的原因吧.没有人指导,只是自己埋着头自己学,什么地方学偏了也不知道。有一点一直认为自己的认识有偏差,就是我总是认为水晶报表很简单,只是能实现选择显示打印的功能。但是她到底能不能实现删改的功能呢?查了一些资料都没有说!但是水晶报表不是都是说功能强大吗!怎么可能只有这么点功能呢?有点怀疑自己!有没有水晶报表学的比较好,可否给点指导呢啊?下面是我收集的一些水晶报表的基础资料:晶报表是一个功能强大的报表工具,现在已经被Microsoft Visual Studio 2005(下文以VS2005简称)集成在 阅读全文
posted @ 2010-03-26 15:36 黄聪 阅读(853) 评论(0) 推荐(0) 编辑