<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>张筱祥博客 &#187; C#</title>
	<atom:link href="http://www.zxxblog.com/tag/c/feed" rel="self" type="application/rss+xml" />
	<link>http://www.zxxblog.com</link>
	<description>专注于网络辅助工具的开发</description>
	<lastBuildDate>Sun, 13 Mar 2011 09:16:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>C# 中 强制退出WinForm程序</title>
		<link>http://www.zxxblog.com/920</link>
		<comments>http://www.zxxblog.com/920#comments</comments>
		<pubDate>Mon, 20 Sep 2010 03:17:39 +0000</pubDate>
		<dc:creator>张筱祥</dc:creator>
				<category><![CDATA[资料收集]]></category>
		<category><![CDATA[Application.Exit()]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C#退出程序]]></category>
		<category><![CDATA[System.Environment.Exit]]></category>
		<category><![CDATA[强制退出程序]]></category>

		<guid isPermaLink="false">http://www.zxxblog.com/920</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160; 这几天写程序需要用到工作完毕自动退出，之前C#一直使用Application.Exit() ,这次使用的时候发现加上这句代码之后程序窗体确实关闭了，但是从任务管理器中可以看到线程仍然存在。 &#160;&#160;&#160;&#160;&#160; 后来从查MSDN和从网上查资料才得知，Dispose()方法，虽然能释放当前窗体的资源，却不能强制结束循环，要想强制突出当前程序要用：System.Environment.Exit(int exitcode)方法。该方法：终止当前进程并为基础操作系统提供指定的退出代码。 &#160;&#160;&#160;&#160;&#160; 所以在程序中需要强制退出的地方加上System.Environment.Exit(System.Environment.ExitCode);&#160; 还有一种方法：&#160; System.Threading.Thread.CurrentThread.Abort(); 或者&#160; Process.GetCurrentProcess().Kill() 或者&#160; Application.ExitThread(); 或者&#160; Application.ExitThread() &#160;&#160;&#160;&#160;&#160; 不过以上方法，都是强制直接退出了整个程序，不只是关闭子窗体。可能还会引发某些问题， 我感觉最好方法的就是，在子窗体的Closing事件中，写循环退出条件，这样就可以避免某些未知的错误，而且可以只关闭子窗体，并释放子窗体占用的资源。 &#160;&#160;&#160;&#160;&#160; Application.Exit(); 方法停止在所有线程上运行的所有消息循环，并关闭应用程序的所有窗口 &#160;&#160;&#160;&#160;&#160; Application.Exit 是一种强行退出方式，就像 Win32 的 PostQuitMessage()。它意味着放弃所有消息泵，展开调用堆栈，并将执行返回给系统。]]></description>
		<wfw:commentRss>http://www.zxxblog.com/920/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C#中结合DataGridView和DateTable来显示数据</title>
		<link>http://www.zxxblog.com/845</link>
		<comments>http://www.zxxblog.com/845#comments</comments>
		<pubDate>Mon, 08 Feb 2010 15:38:47 +0000</pubDate>
		<dc:creator>张筱祥</dc:creator>
				<category><![CDATA[资料收集]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DataTable]]></category>

		<guid isPermaLink="false">http://www.zxxblog.com/845</guid>
		<description><![CDATA[今天看一个源码，有个特点是使用DataGridView和DateTable来显示数据。之前张筱祥总是喜欢用listbox和listview来显示数据，用起来也挺习惯，但是DataGridView有很多listview无法比拟的特点。这里记录下他在Winform中结合DateTabble的常用方法。 Code //1. 创建table 并建立列表头 DataTable table = new DataTable(); DataColumn c1 = new DataColumn(&#34;订单编号&#34;, typeof(string)); table.Columns.Add(c1); DataColumn c2 = new DataColumn(&#34;买家昵称&#34;, typeof(string)); table.Columns.Add(c2); DataColumn c3 = new DataColumn(&#34;卖家昵称&#34;, typeof(string)); table.Columns.Add(c3); DataColumn c4 = new DataColumn(&#34;订单状态&#34;, typeof(string)); table.Columns.Add(c4); DataColumn c5 = new DataColumn(&#34;商品标题&#34;, typeof(string)); table.Columns.Add(c5); DataColumn c6 = new DataColumn(&#34;价格&#34;, typeof(string)); table.Columns.Add(c6); DataColumn c7 = [...]]]></description>
		<wfw:commentRss>http://www.zxxblog.com/845/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C#调用亦思DLL识别验证码备份</title>
		<link>http://www.zxxblog.com/820</link>
		<comments>http://www.zxxblog.com/820#comments</comments>
		<pubDate>Tue, 19 Jan 2010 04:01:34 +0000</pubDate>
		<dc:creator>张筱祥</dc:creator>
				<category><![CDATA[资料收集]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C#调用亦思]]></category>

		<guid isPermaLink="false">http://www.zxxblog.com/820</guid>
		<description><![CDATA[&#160; 下面是关于C#调用亦思DLL来识别验证码的方法的，需要亦思破解版的可以加群：37140394，找群主要。这里是自己从易语言的调用方法中修改过来的，有2种识别方式，第一种保存到本地识别，第二种直接在内存中识别。 &#160; 保存到本地识别的方法 public static void Recognition(ref string jieguo, string url, string locatepic, ref string resultpic) {     try     {         int i = 0;         int n2 = 0;         IntPtr n1 = new IntPtr(); &#160;         IntPtr no1 = Recognition(1, null, 0, url, locatepic, ref n1, ref n2, ref i);         jieguo = Marshal.PtrToStringAnsi(no1);      //   Writepic(&#34;&#34;);     //这行代码的目的是把图片解码成bmp图片，可选。                  //    resultpic = @&#34;c:&#92;code.bmp&#34;;  //默认存放到c:&#92;code.bmp [...]]]></description>
		<wfw:commentRss>http://www.zxxblog.com/820/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>今天一个群的聊天记录</title>
		<link>http://www.zxxblog.com/751</link>
		<comments>http://www.zxxblog.com/751#comments</comments>
		<pubDate>Thu, 07 Jan 2010 13:40:50 +0000</pubDate>
		<dc:creator>张筱祥</dc:creator>
				<category><![CDATA[资料收集]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[娱乐]]></category>
		<category><![CDATA[淘宝]]></category>

		<guid isPermaLink="false">http://www.zxxblog.com/751</guid>
		<description><![CDATA[silence&#8230;(1) 21:24:59 我就搞不懂了,既然是webbrowser方式填表,那填上去的原始密码数值和键盘手输入的原始密码数值难道不同么?   TOM.com&#60;1&#62; 21:25:08 有淘宝的控件加密算法？ Blue Eyes(1) 21:25:07 vb 我几乎看不懂   Blue Eyes(1) 21:25:23 tb tokn  这个？ silence&#8230;(1) 21:25:30 DELPHI的源码你都能看成是VB的佩服你 Blue Eyes(1) 21:25:35 呵呵 就是啊 Blue Eyes(1) 21:25:41 各行如隔山 Blue Eyes(1) 21:25:47 我菜啊 Blue Eyes(1) 21:25:48 555555555 silence&#8230;(1) 21:26:05 TOM.com 你说说 ,既然是webbrowser方式填表,那填上去的原始密码数值和键盘手输入的原始密码数值难道不同么? Blue Eyes(1) 21:26:24 我没研究过那么多网站  Blue Eyes(1) 21:26:38 而其我很少用 web这种控件 Blue Eyes(1) 21:26:52 [...]]]></description>
		<wfw:commentRss>http://www.zxxblog.com/751/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>C#直接调用项目中的资源</title>
		<link>http://www.zxxblog.com/728</link>
		<comments>http://www.zxxblog.com/728#comments</comments>
		<pubDate>Tue, 05 Jan 2010 16:05:06 +0000</pubDate>
		<dc:creator>张筱祥</dc:creator>
				<category><![CDATA[资料收集]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.zxxblog.com/728</guid>
		<description><![CDATA[Code private void button1_Click(object sender, EventArgs e) {     ResourceManager rm = new ResourceManager(&#34;UseResourceBinary.Properties.Resources&#34;, Assembly.GetExecutingAssembly());     this.label1.Text = rm.GetString(&#34;姓名&#34;);     this.pictureBox1.Image = rm.GetObject(&#34;张筱祥照片&#34;) as Image; } &#160; private void button2_Click(object sender, EventArgs e) {     this.label1.Text = Properties.Resources.姓名;     this.pictureBox1.Image = Properties.Resources.张筱祥照片; } 这个有点类似于易语言里面的常量和资源吧，直接把一些图片文件等存放到程序里面，需要用到的时候直接用属性调用，可以添加的资源有：]]></description>
		<wfw:commentRss>http://www.zxxblog.com/728/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#贴边自动隐藏组件完美版[转]</title>
		<link>http://www.zxxblog.com/724</link>
		<comments>http://www.zxxblog.com/724#comments</comments>
		<pubDate>Tue, 05 Jan 2010 16:04:15 +0000</pubDate>
		<dc:creator>张筱祥</dc:creator>
				<category><![CDATA[资料收集]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.zxxblog.com/724</guid>
		<description><![CDATA[&#160; 原文地址：http://www.cnblogs.com/Red_angelX/archive/2008/07/04/1235377.html]]></description>
		<wfw:commentRss>http://www.zxxblog.com/724/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Form程序中textbox和button的焦点问题</title>
		<link>http://www.zxxblog.com/654</link>
		<comments>http://www.zxxblog.com/654#comments</comments>
		<pubDate>Thu, 31 Dec 2009 16:18:28 +0000</pubDate>
		<dc:creator>张筱祥</dc:creator>
				<category><![CDATA[资料收集]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[编程经验]]></category>

		<guid isPermaLink="false">http://www.zxxblog.com/654</guid>
		<description><![CDATA[问题环境： 现在有一个textbox输入框，一个btn_OK按钮，一个btn_Cancle 按钮。我需要在textbox里面输入一段内容，然后按btn_OK提交。现在我想达到内容输入完毕后按回车直接提交。 问题分析： 通常情况下，输完内容之后需要鼠标点击btn_OK或者使用tab键把焦点切换到按钮上，然后再按回车提交。这样就有点小麻烦。 问题解决： 解决方法应该有几种，第一是在textbox的事件里面写一个与btn_OK事件的等效代码。这个也有点麻烦，有人说可以直接设置textbox和btn_OK的tabindex值一样，我在vs2008下测试发现不行，焦点只能在一个控件上。第二种解决方法最简单，就是将窗体的AcceptButton属性设置为btn_OK按钮。这样btn_OK按钮会一直处于获取焦点状态（如下图）。 &#160; &#160;]]></description>
		<wfw:commentRss>http://www.zxxblog.com/654/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>C#通过wap开心网首页匹配个人信息</title>
		<link>http://www.zxxblog.com/634</link>
		<comments>http://www.zxxblog.com/634#comments</comments>
		<pubDate>Wed, 30 Dec 2009 08:44:57 +0000</pubDate>
		<dc:creator>张筱祥</dc:creator>
				<category><![CDATA[心情日志]]></category>
		<category><![CDATA[资料收集]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[开心网]]></category>

		<guid isPermaLink="false">http://www.zxxblog.com/634</guid>
		<description><![CDATA[下面这段代码在程序中不需要了，贴到这里保存下。 Code  下面是wap验证账号方式 list_User.Items[i].SubItems[7].Text = &#34;登陆成功&#34;; Show_Log(&#34;[账号：]&#34; + list_User.Items[i].SubItems[1].Text + &#34; 登陆成功。&#34;); Match match = Regex.Match(htmlcode, @&#34;(?&#60;=uid=)&#92;d+&#34;); if (match.Success) {     Accountlist[i].UserID = match.ToString(); &#160;     list_User.Items[i].SubItems[3].Text = match.ToString(); &#160;     match = Regex.Match(htmlcode, @&#34;[^&#34;&#34;]+(?=&#34;&#34; class=&#34;&#34;tdno&#34;&#34;&#62;好友)&#34;); &#160; &#160;     string url = &#34;http://wap.kaixin001.com&#34; + match.ToString();     htmlcode = eking.WAPGet(url, &#34;utf-8&#34;, cookie); &#160;     match = Regex.Match(htmlcode, @&#34;(?&#60;=&#60;span class=&#34;&#34;c6&#34;&#34;&#62;共)&#92;d+&#34;); &#160;     Accountlist[i].FriendCount = [...]]]></description>
		<wfw:commentRss>http://www.zxxblog.com/634/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>收藏一个C# 汉字转拼音静态类</title>
		<link>http://www.zxxblog.com/620</link>
		<comments>http://www.zxxblog.com/620#comments</comments>
		<pubDate>Mon, 28 Dec 2009 08:19:18 +0000</pubDate>
		<dc:creator>张筱祥</dc:creator>
				<category><![CDATA[资料收集]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[汉字转拼音]]></category>

		<guid isPermaLink="false">http://www.zxxblog.com/620</guid>
		<description><![CDATA[互联网真是个好东西，需要什么有什么，哈哈。今天看到一个邮箱注册软件注册的时候可以将文字的拼音也记录下来，于是百度了一下“C# 汉字 拼音”，找到下面这段代码，收藏一下，需要的时候再来试试。 因为是静态函数，调用方法很简单：CrazyCoderPinyin.Convert(&#34;张筱祥&#34;); 代码如下： using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; using System.Web; namespace CrazyCoder.Common { /// &#60;summary&#62; &#160;&#160;&#160; /// 汉字转拼音类 &#160;&#160;&#160; /// by http://www.crazycoder.cn &#160;&#160;&#160; /// build Date 20030610 &#160;&#160;&#160; /// &#60;/summary&#62; &#160;&#160;&#160; public class CrazyCoderPinyin &#160;&#160;&#160; { &#160;&#160;&#160;&#160;&#160;&#160;&#160; /// &#60;summary&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160; /// 定义拼音区编码数组 &#160;&#160;&#160;&#160;&#160;&#160;&#160; /// &#60;/summary&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160; private static int[] pyValue [...]]]></description>
		<wfw:commentRss>http://www.zxxblog.com/620/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[转]一些C# 面试题及答案</title>
		<link>http://www.zxxblog.com/607</link>
		<comments>http://www.zxxblog.com/607#comments</comments>
		<pubDate>Sun, 27 Dec 2009 07:06:22 +0000</pubDate>
		<dc:creator>张筱祥</dc:creator>
				<category><![CDATA[资料收集]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[张筱祥]]></category>

		<guid isPermaLink="false">http://www.zxxblog.com/607</guid>
		<description><![CDATA[1. 简述 private、 protected、 public、 internal 修饰符的访问权限。 答 . private : 私有成员, 在类的内部才可以访问。 protected : 保护成员，该类内部和继承类中可以访问。 public : 公共成员，完全公开，没有访问限制。 internal: 在同一命名空间内可以访问。 2 .列举ASP.NET 页面之间传递值的几种方式。 答. 1.使用QueryString, 如&#8230;.?id=1; response. Redirect()&#8230;. &#160;&#160;&#160;&#160;&#160; 2.使用Session变量 &#160;&#160;&#160;&#160;&#160; 3.使用Server.Transfer 3. 一列数的规则如下: 1、1、2、3、5、8、13、21、34&#8230;&#8230; 求第30位数是多少， 用递归算法实现。 答：public class MainClass { public static void Main() { Console.WriteLine(Foo(30)); } public static int Foo(int i) { [...]]]></description>
		<wfw:commentRss>http://www.zxxblog.com/607/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#下如何实现点击窗口中任意位置拖动窗口</title>
		<link>http://www.zxxblog.com/601</link>
		<comments>http://www.zxxblog.com/601#comments</comments>
		<pubDate>Fri, 25 Dec 2009 14:03:39 +0000</pubDate>
		<dc:creator>张筱祥</dc:creator>
				<category><![CDATA[资料收集]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.zxxblog.com/601</guid>
		<description><![CDATA[今天需要用到这个，于是百度了一下。从百度知道找到了答案，效果很满意。 问：鼠标在窗口的任意位置按下，即可把窗口拖动到其它位置。通常标准的Windows窗口只有在标题栏上按下鼠标才可以拖动，那么如何实现窗口的任意位置都可以拖动呢？ 答： 响应窗口的MouseDown和MouseMove消息 private Point offset; &#160;       private void Form1_MouseDown(object sender, MouseEventArgs e)       {           if (MouseButtons.Left != e.Button) return; &#160;           Point cur = this.PointToScreen(e.Location);           offset = new Point(cur.X &#8211; this.Left, cur.Y &#8211; this.Top);       } &#160;       private void Form1_MouseMove(object sender, MouseEventArgs e)       {           if (MouseButtons.Left != e.Button) return; &#160;           Point cur = MousePosition;           this.Location = [...]]]></description>
		<wfw:commentRss>http://www.zxxblog.com/601/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>有时候看到一句好代码，要回味好几天</title>
		<link>http://www.zxxblog.com/568</link>
		<comments>http://www.zxxblog.com/568#comments</comments>
		<pubDate>Wed, 23 Dec 2009 18:14:15 +0000</pubDate>
		<dc:creator>张筱祥</dc:creator>
				<category><![CDATA[心情日志]]></category>
		<category><![CDATA[资料收集]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[张筱祥]]></category>
		<category><![CDATA[编程经验]]></category>

		<guid isPermaLink="false">http://www.zxxblog.com/568</guid>
		<description><![CDATA[昨天晚上，看csdn上一个人的博客，写的文章都挺好的，列举了他的部分作品以及部分源码截图。其中看到一句很好的代码，至少我认为很好。 他是这么写的： Code ShowLog(&#34;账户密码错误！请修改密码重试！&#34;); 具体的ShowLog方法的代码在他文中并没有写出来，但是我也差不多能猜出其中的代码了。主要就是显示一些提示信息。 &#160; 而我通常写程序的时候，都是直接写需要显示的内容，没有封装成方法，这样不仅不美观，而且要是修改起来也麻烦。张筱祥的代码如下。 Code if (LoginResult)             {                 richTextBox_Log.AppendText(&#34;[&#34; + DateTime.Now.ToString() + &#34;][系统：]登陆成功。&#92;r&#92;n&#34;);             }             else             {                 richTextBox_Log.AppendText(&#34;[&#34; + DateTime.Now.ToString() + &#34;][系统：]登陆失败。&#92;r&#92;n&#34;);             } &#160; 下面我把自己的代码封装起来，就变成了这样 Code if (LoginResult)           {               ShowLog(&#34;登陆成功。&#34;);           }           else           {               ShowLog(&#34;登陆失败。&#34;);           } &#160;       public void ShowLog(string log)       {           richTextBox_Log.AppendText(&#34;[&#34; + DateTime.Now.ToString() + &#34;][系统：]&#34; + log + &#34;&#92;r&#92;n&#34;);       } &#160; 经过处理后是不是简单很多啊？当然，如果只是几处需要显示log的时候没必要封装，但是如果一个程序中有上百行需要显示给用户看的log，那么封装起来肯定方便多了。 [...]]]></description>
		<wfw:commentRss>http://www.zxxblog.com/568/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

