随笔分类 -  C#

摘要:这个似乎是FTP下载的:#region "Download: File transfer FROM ftp server" /// <summary> /// Copy a file from FTP server to local /// </summary> /// <param name="sourceFilename">Target filename, if required </param> /// <param name="localFilename">Full 阅读全文
posted @ 2011-08-23 09:42 slcands 阅读(337) 评论(0) 推荐(0)
摘要:UDP的:namespace UDPServer{ class Program { static void Main(string[] args) { int recv; byte[] data = new byte[1024]; //构建TCP 服务器 //得到本机IP,设置TCP端口号 IPEndPoint ipep = new IPEndPoint(IPAddress.Any , 8001); So... 阅读全文
posted @ 2011-08-23 09:37 slcands 阅读(436) 评论(0) 推荐(0)
摘要:http://topic.csdn.net/u/20080623/08/4bbd2475-45f1-42e3-a613-16b094759ade.htmlSocket通讯:public class XmlSocket { //异步socket诊听 // Incoming data from client.从客户端传来的数据 public static string data = null; // Thread signal.线程 用一个指示是否将初始状态设置为终止的布尔值初始化 ManualResetEvent 类的新实例。 ... 阅读全文
posted @ 2011-08-23 09:27 slcands 阅读(301) 评论(0) 推荐(0)
摘要:/// 〈summary〉/// 汉字转拼音缩写/// 2004-11-30/// 〈/summary〉/// 〈param name="str"〉要转换的汉字字符串〈/param〉/// 〈returns〉拼音缩写〈/returns〉public string GetPYString(string str){ string tempStr = "";; foreach(char c in str) { if((int)c 〉= 33 && (int)c 〈=126) {//字母和符号原样保留 tempStr += c.ToString( 阅读全文
posted @ 2011-08-04 13:00 slcands 阅读(255) 评论(0) 推荐(1)
摘要:Test.csusing System;using System.Drawing;using System.Windows.Forms;using System.Runtime.InteropServices;using System.Reflection;namespace ColorCursor{/// <summary>/// 本例子的作用:/// 在.NET中实现彩色光标,动画光标和自定义光标。/// </summary>public class Form1 : System.Windows.Forms.Form{[DllImport("user32. 阅读全文
posted @ 2011-08-04 12:56 slcands 阅读(163) 评论(0) 推荐(0)
摘要:using System.Runtime.InteropServices;using System.Drawing;using System.Drawing.Imaging;namespace PickHead{/// <summary>/// 一个控制摄像头的类/// </summary>public class Pick{private const int WM_USER = 0x400;private const int WS_CHILD = 0x40000000;private const int WS_VISIBLE = 0x10000000;private 阅读全文
posted @ 2011-08-04 12:55 slcands 阅读(483) 评论(0) 推荐(1)
摘要:ColorMatrix (彩色矩阵) 类位于System.Drawing.Imaging命名空间 先看看下面的代码ColorMatrix cm = new ColorMatrix(new float[][]{ new float[]{0.5f,0.5f,0.5f,0,0},new float[]{0.5f,0.5f,0.5f,0,0},new float[]{0.5f,0.5f,0.5f,0,0},new float[]{0,0,0,1,0,0},new float[]{0,0,0,0,1,0},new float[]{0,0,0,0,0,1}});矩阵系数组成一个 5x5 的线性转换,用于转 阅读全文
posted @ 2011-08-04 12:51 slcands 阅读(290) 评论(0) 推荐(1)
摘要:public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { System.Windows.Forms.Timer StopRectTimer = new System.Windows.Forms.Timer(); StopRectTimer.Tick += new EventHandler(timer1_Tick); StopRectTimer.Interval = 50; StopRect. 阅读全文
posted @ 2011-08-04 12:48 slcands 阅读(236) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace 图形动画...{ public partial class Form1 : Form ...{ public Form1() ...{ InitializeComponent(); } private void Form1_Load(object sender, 阅读全文
posted @ 2011-08-04 12:46 slcands 阅读(956) 评论(0) 推荐(2)
摘要:我的上一篇文章已经阐述了“32位程序和64位程序在64位平台上读\写注册表的区别”,那么接下来将要回答上篇所留下来的一个问题:32位程序如何访问64位系统注册表(即:64位程序所访问的注册表位置)。 我们已经知道: ①:本机模式 64 位程序运行在纯模式下,并且访问键和存储在以下注册表子键中的值:HKEY_LOCAL_MACHINE\Software ②:32 位程序运行在 WOW64 模式下,并且访问键和值存储在以下注册表子项中:HKEY_LOCAL_MACHINE\Software\WOW6432nod 那么要实现32为程序访问64位注册表信息,还要知道如下概念:1:文件系统转向。2:注. 阅读全文
posted @ 2011-07-22 10:44 slcands 阅读(732) 评论(1) 推荐(1)
摘要:用C#实现注册表的读\写是一件很容易的事情,在此不做详细的讲解。 用C#操作注册表主要用到的两个函数为(已经渗透到下面的实例程序中,注:要引入Microsoft.Win32命名空间): 1:读取键值-->Registry.LocalMachine.OpenSubKey(“..Key的路径...”, true),这里的第2个bool类型的参数含义为:标志打开的键值是否可以更改(即:是否可以用SetValue()给键赋值),然后调用GetValue()方法就能把键值读取出来。 2:写入键值-->Registry.LocalMachine.CreateSubKey("..Key 阅读全文
posted @ 2011-07-22 10:33 slcands 阅读(322) 评论(0) 推荐(1)