- 博客(55)
- 收藏
- 关注
原创 C#代码搜索工具
搜索本机所有C#代码(.cs结尾的文件),使用Task.Run在后台异步加载,本机搜索不到时会自动打开cn.bing.com网站去搜using System;using System.Collections.Generic;using System.Drawing;using System.Text;using System.Threading.Tasks;using Sys
2017-03-21 22:48:52
1229
原创 限制应用程序只能打开一个
bool createNew; var mutex = new Mutex(false,"SingletonWinAppMutex",out createNew); if(!createNew) { MessageBox.Show("Can only start one instance");
2016-12-21 21:11:10
848
原创 LINQ相关的集合操作
摘选自C#高级编程(第9版) --C# 5.0 & .NET 4.5.1Code: static void Main(string[] args) { LinqQuery(); object[] data = { "one", 2, 3, "four", "five", 6 }; var q
2016-12-05 21:38:55
309
原创 oracle数据库访问类
using System;using System.Collections.Generic;using System.Text;using System.Data;using System.Windows.Forms;using System.Data.OracleClient;//using Oracle.DataAccess;//using Oracle.DataAccess.T
2015-10-27 18:05:22
493
原创 永久隐藏任务栏
Code:using System;using System.Collections.Generic;using System.Runtime.InteropServices;namespace CsDev{ class c2 { private const int SW_HIDE = 0; private const int SW
2014-03-25 19:39:17
1736
原创 DLL调用
先编写一个简单的类如下:namespace Cryking{ public class MathLib { public int Mul( int x,int y) { return x * y; } }}保存为MathLib.cs文件然后使用如下命令编译成dll文件csc /o
2014-03-22 22:49:29
519
原创 反射(Reflection)
通过反射来构造类的实例、执行类的方法、属性设置等。// Comment out the following line to test,// bind, and invoke as separate steps.#define BindAndInvokeTogetherusing System;using System.Reflection;using System.Threading
2014-03-18 20:27:30
588
原创 垃圾回收(GC)
(刚进入管理堆的对象称为0代对象)0代对象使用空间阈值为256KB如果有新对象使得超过阈值,那么就会导致启动GC.经过GC回收之后剩下的对象叫1代对象.此时0代就为空了,那么后面新分配的对象将会在0代空间。1代阈值为2MB。GC会忽略1代对象也直接回收0代对象,因为GC会假定越新的对象其生命周期越短。2代阈值越为10M左右。管理堆只支持0代、1代、2代。(没有3代,可通过GC.
2014-03-18 00:03:54
784
原创 委托(delegate)
Code:using System;using System.Windows.Forms;using System.IO;class Set{ private Object[] items; public Set(Int32 numItems) { items = new Object[numItems]; for (Int32 i
2014-03-14 09:17:56
566
原创 字符串比较之object.ReferenceEquals方法
Code:using System;using System.Text;namespace CsDev{ class Class3 { static void Main() { string a = "avd"; string b = "av"; string c
2014-03-11 12:24:29
1903
原创 统计代码文件的注释行
使用了并行处理、lambda表达式、字典集合、using语句、文件处理等技术。功能:统计指定目录下(包括子目录)所有.CS文件中的注释行源码:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using
2014-03-02 00:24:23
1096
原创 调用COM方法
请先引用Microsoft.Office.Interop.Word.dll调用Word里的拼写检查方法,注意需要先安装了Word.CODE:using System;using System.Reflection;using Microsoft.Office.Interop.Word;namespace CsStudy{ class Pro {
2014-03-01 13:56:38
801
原创 异步编程
Code:using System;using System.Runtime.Remoting.Messaging;using System.Threading;namespace CsStudy{ delegate long MyDel(int first, int second); class Program { int TimesCall
2014-02-28 21:40:52
568
原创 进度条(BackgroundWorker后台线程处理)--WPF应用
源码:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Document
2014-02-28 15:58:17
1086
原创 XML相关
创建XML以及读取XMLusing System;using System.Xml.Linq;namespace CsStudy{ class Program { static void Main() { XDocument e = new XDocument( new XEleme
2014-02-28 00:03:13
566
原创 LINQ
CODE:using System;using System.Linq;namespace CsStudy{ class Program { static void Main() { var gA = new[] { 2, 3, 4, 5 }; var gB = new[] { 6, 7,
2014-02-27 23:51:54
554
原创 用户自定义类型转换
CODE:using System;namespace CsStudy{ class Per { public int p = 5; public static implicit operator int(Per a)//自定义隐式类型转换 { return a.p + 1; }
2014-02-26 20:30:04
671
原创 事件
CODE:using System;namespace CsDev{ public delegate void myEventHandler(string a);//自定义事件类型 class eventTest { public event myEventHandler myEvent; public event EventHan
2014-02-26 13:36:13
586
原创 委托和匿名方法、lambda表达式
CODE:using System;namespace CsDev{ delegate void delTest(string a);//委托定义 delegate void delTest1(int a,params int[] b); public class c2 { void testMethod(string a)
2014-02-26 12:18:58
681
原创 矩形数组和交错数组
CODE:using System;namespace CsStudy{ class Program { static void Main() { //矩形数组声明及初始化 int[,] aint = new int[2, 3]; int[,] bint = new i
2014-02-25 22:48:27
882
原创 using语句
来源:>示例:using System;using System.IO;namespace CsDev{ public class c2 { public static void Main() { using (TextWriter tw1 = File.CreateText("tw1.txt"),
2014-02-25 13:01:02
593
原创 索引器(Indexer)
来源:>Code:using System;namespace CsDev{ class Class1 { string a; string b; string c; public string this[int index]//索引器定义 { set
2014-02-25 09:11:17
729
原创 扩展方法
来源:>扩展方法示例:using System;namespace CsStudy{ sealed class Test { double D1, D2, D3; public Test(double d1, double d2, double d3) { D1 = d1; D2 = d2; D3
2014-02-24 20:25:47
596
原创 特性的简单使用(Attribute)
using System;using System.Reflection;//特性使用namespace CsDev{ public class TransactionableAttribute : Attribute { public TransactionableAttribute(string a) { Con
2014-02-17 12:10:25
651
原创 空心字HollowFont
FontMenuForm 基类见:http://blog.youkuaiyun.com/u013384702/article/details/17884617Code:using System;using System.Drawing;using System.Drawing.Drawing2D;using System.Windows.Forms;namespace CsStudy
2014-01-09 21:19:24
1121
原创 图片下载ImageFromWeb
Code:using System;using System.Windows.Forms;using System.Drawing;using System.Drawing.Drawing2D;using System.Net;using System.IO;namespace CsStudy{ class ImageFromWeb : Form {
2014-01-09 20:14:07
652
原创 自定义控件之选择框CheckerWithChild
自定义控件类CheckerChild,继承自UserControl类:using System;using System.Windows.Forms;using System.Drawing;namespace CsDev{ //自定义自控件 class CheckerChild:UserControl { bool bChecked =
2014-01-09 16:21:42
597
原创 复选框及字体风格CheckBoxDemo
Code:using System;using System.Windows.Forms;using System.Drawing;namespace CsDev{ class CheckBoxDemo:Form { public static void Main() { Application.Run(new
2014-01-09 13:19:50
981
原创 彩色字ClipText
FontMenuForm 基类见:http://blog.youkuaiyun.com/u013384702/article/details/17884617字体裁剪的应用Code:using System;using System.Drawing;using System.Drawing.Drawing2D;using System.Windows.Forms;namespace
2014-01-07 20:29:31
691
原创 数字时钟DigClock
首先建立数字显示类:using System;using System.Drawing;namespace CsDev{ class SevenSegmentDispay { Graphics grph; //0,1,2,3,4,5,6,7,8,9 static byte[,] bySegment = { { 1, 1,
2014-01-07 10:30:23
1157
原创 菜单的选项按钮及复选框CheckAndRadioCheck
Code:using System;using System.Windows.Forms;using System.Drawing;namespace CsDev{ class CheckAndRadioCheck : Form { MenuItem miColor, miFill; static void Main()
2014-01-07 09:21:23
782
原创 分隔器控件使用示例PanelWithSplitter
Code:using System;using System.Windows.Forms;using System.Drawing;namespace CsDev{ class PanelWithSplitter : Form { float fproportion = 0.5f; Panel panel2; pub
2014-01-06 13:51:27
648
原创 自动缩放AutoScaleDemo
Code:using System;using System.Windows.Forms;using System.Drawing;namespace CsDev{ class AutoScaleDemo : Form { public static void Main() { Application.Run(n
2014-01-06 12:53:48
1233
原创 文本变形WarpText
FontMenuForm 基类见:http://blog.youkuaiyun.com/u013384702/article/details/17884617using System;using System.Drawing;using System.Drawing.Drawing2D;using System.Windows.Forms;namespace CsStudy{ cl
2014-01-05 18:03:12
795
原创 环绕的字WrapText
FontMenuForm 基类见:http://blog.youkuaiyun.com/u013384702/article/details/17884617Code:using System;using System.Drawing;using System.Drawing.Drawing2D;using System.Windows.Forms;namespace CsStudy{
2014-01-05 17:49:51
910
原创 旋转的字RotatedFont
FontMenuForm 基类见:http://blog.youkuaiyun.com/u013384702/article/details/17884617Code:using System;using System.Drawing;using System.Windows.Forms;namespace CsStudy{ class RotatedFont : Fon
2014-01-05 16:38:47
554
原创 反射的字ReflectedText
FontMenuForm 基类见:http://blog.youkuaiyun.com/u013384702/article/details/17884617Code:using System;using System.Drawing;using System.Drawing.Drawing2D;using System.Windows.Forms;namespace CsStu
2014-01-05 16:28:40
518
原创 浮雕字EmbossedText
FontMenuForm 基类见:http://blog.youkuaiyun.com/u013384702/article/details/17884617using System;using System.Drawing;using System.Windows.Forms;namespace CsStudy{ class EmbossedText : FontMenuF
2014-01-05 16:09:04
839
原创 投影字DropShadow
Code:using System;using System.Drawing;using System.Windows.Forms;namespace CsStudy{ class DropShadow : FontMenuForm { const int iOffset = 10; public new static void Ma
2014-01-05 16:01:26
523
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人