非专业程序员

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

2010年8月3日

摘要: 多线程使用TextBox控件 //声明一个委托 public delegate void SetTextBoxValue(string value); //委托使用文本框 void SetMyTextBoxValue(string value) { // Control.InvokeRequired 属性: 获取一个值,该值指示调用方在对控件进行方法调用时是否必须调用 Invoke 方法,因为调用方位于创建控件所在的线程以外的线程中。当前线程不是创建控件的线程时为true,当前线程中访问是False if (this.TextBoxControl.InvokeRequired) { SetTe 阅读全文
posted @ 2010-08-03 22:55 曲仁岗 阅读(717) 评论(0) 推荐(0) 编辑

2010年8月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.IO;using Microsoft.Win32;using System.Runtime.InteropServices;using System.Net;using System.Net.Sockets;namespace CommonLibrary{ 阅读全文
posted @ 2010-08-01 18:24 曲仁岗 阅读(820) 评论(0) 推荐(0) 编辑

摘要: 引言委托 和 事件在 .Net Framework中的应用非常广泛,然而,较好地理解委托和事件对很多接触C#时间不长的人来说并不容易。它们就像是一道槛儿,过了这个槛的人,觉得真是太容易了,而没有过去的人每次见到委托和事件就觉得心里别(biè)得慌,混身不自在。本文中,我将通过两个范例由浅入深地讲述什么是委托、为什么要使用委托、事件的由来、.Net Framework中的委托和事件、委托和事件对Observer设计模式的意义,对它们的中间代码也做了讨论。将方法作为方法的参数我们先不管这个标题如何的绕口,也不管委托究竟是个什么东西,来看下面这两个最简单的方法,它们不过是在屏幕上输出一句问 阅读全文
posted @ 2010-08-01 18:12 曲仁岗 阅读(241) 评论(0) 推荐(0) 编辑

2009年4月19日

摘要: #include <stdio.h>#include <iostream>#include <math.h>#define NULL 0#define LEN sizeof(student)struct student{ int num; double score; student* next;};int n;student* create(void){ student *head; student *p1,*p2; n=0; p1=p2=(student*)malloc(LEN); scanf("%d%lf",&p1->n 阅读全文
posted @ 2009-04-19 13:36 曲仁岗 阅读(248) 评论(0) 推荐(0) 编辑

2008年12月26日

摘要: #include<iostream> #include<string> #include<vector> #include<bitset> #include<cstddef> #include<ctime> usingnamespacestd;intmain(){constchar*pc="Averylongstring,testCandC++speed!";constsize_tlen=strlen(pc);clock_tt1,t2;t1=clock();for(size_tix=0;ix!=1000 阅读全文
posted @ 2008-12-26 10:33 曲仁岗 阅读(292) 评论(0) 推荐(0) 编辑

2008年12月4日

摘要: #include<iostream> #include<string> #include<vector> #include<algorithm> #include<sstream> #include<list> usingnamespacestd;doublestod(string&in){stringstreamsstr(in);doubled;sstr>>d;returnd;}intmain(intargc,char**argv){stringmeast;cout<<"请输入尺 阅读全文
posted @ 2008-12-04 10:12 曲仁岗 阅读(218) 评论(0) 推荐(0) 编辑

2008年12月3日

摘要: #include<algorithm> #include<vector> #include<string> #include<iostream> #include<numeric> #include<iterator> #include<sstream> #include<list> #include<fstream> usingnamespacestd;boolbind(constinti,constintj){if(i%2==0&&j%2!=0)returntrue; 阅读全文
posted @ 2008-12-03 11:41 曲仁岗 阅读(156) 评论(0) 推荐(0) 编辑

2008年11月30日

摘要: #include<iostream> #include<sstream> #include<string> #include<list> #include<fstream> #include<map> #include<vector> #include<utility> #include<iomanip>//控制格式输出的 #include<set> #include<algorithm> usingnamespacestd;std::ifstream&o 阅读全文
posted @ 2008-11-30 21:57 曲仁岗 阅读(133) 评论(0) 推荐(0) 编辑

摘要: #include<iostream> #include<sstream> #include<string> #include<list> #include<fstream> #include<map> #include<vector> #include<utility> #include<iomanip>//控制格式输出的, usingnamespacestd;std::ifstream&open_file(ifstream&in,conststringfile_name 阅读全文
posted @ 2008-11-30 10:57 曲仁岗 阅读(126) 评论(0) 推荐(0) 编辑

2008年11月29日

摘要: #include<iostream> #include<sstream> #include<string> #include<list> #include<map> #include<vector> #include<utility> #include<iomanip>//控制格式输出的, usingnamespacestd;intmain(intargc,char**argv){stringline1="Wewereherprideof10shenamedus:";string 阅读全文
posted @ 2008-11-29 10:24 曲仁岗 阅读(144) 评论(0) 推荐(0) 编辑