第一章、C#委托和事件(Delegate、Event、EventHandler、EventArgs)
第一章、C#委托和事件(Delegate、Event、EventHandler、EventArgs)分类: 学习笔记-C#网络编程2012-12-08 14:10 7417人阅读 评论(3) 收藏 举报delegateeventEventArgsEventHandler http://www.cnb...
c#事件处理中事件信息EventArgs的使用和类型内部事件委托delegate的调用
事件信息EventArgs:http://msdn.microsoft.com/zh-cn/library/system.eventargs.aspx 1事件信息可以用于传递处理附带的事件数值,可以自定义事件信息类型来继承 2事件委托可以声明在事件的类型中,并可以通过【类型名.事件委托名】来调用该委...
EventArgs e){ss.Pause();}private void buttonContinue_Click(
教你如何用C#制作文字转换成声音措施在System.Speech定名空间下,SpeechSynthesizer类可以把文字读出来,一起来玩下~~首先在Windows窗体项目中引入System.Speech。界面部分:后台代码也很简单,,只不过挪用了SpeechSynthesizer类的一些要领:us...
C# 委托和事件(二):使用事件参数(EventArgs)
前面一篇里提到事件是通过委托来进行关联的,而委托是可以带各种各样的参数的,其中就可以用事件参数(EventArgs),同时,也可以用.Net框架里边提供的一个委托EventHandler来Handle事件。一样,搞一个场景(这个场景是书里的):买车。经销商(CarDealer)会上新车(NewCar...
[转载]C#委托和事件(Delegate、Event、EventHandler、EventArgs)
标签:原文链接:14.1、委托当要把方法作为实参传送给其他方法的形参时,形参需要使用委托。委托是一个类型,是一个函数指针类型,这个类型将该委托的实例化对象所能指向的函数的细节封装起来了,即规定了所能指向的函数的签名,也就是限制了所能指向的函数的参数和返回值。当实例化委托的时候,委托对象会指向某一个匹...
委托与事件代码详解与(Object sender,EventArgs e)详解
委托与事件代码详解usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespace@Delegate//自定义命名空间,新建控制台程序,命名后自动添加{ //热水器 publicclassHeater { ...
EventArgs e) { richTextBox1.SelectionStart = richTextBox1.T
C#richtextbox自动滚动到最后 光标到最后自动显示最后一行privatevoidrichTextBox1_TextChanged(objectsender,EventArgse) { richTextBox1.SelectionStart=richTextB...
EventArgs e) { DialogResult drt = fontDialog1.ShowDialog();
//用colorDialog窗口控件设置字体颜色privatevoidtoolStripButton1_Click(objectsender,EventArgse){DialogResultdrt=colorDialog1.ShowDialog();if(drt==DialogResult.OK){...
可传输一个字符串 public class DownloadEventArgs:EventArgs { public s
//设置一个下载事件类,,可传输一个字符串 publicclassDownloadEventArgs:EventArgs { publicstringid{get;set;} publicDownloadEventArgs(stringm) { id=m; } ...
EventArgs e){ // 调用IE浏览器 System.Diagnostics.Process.Start(
从注册表中读取默认浏览器可执行文件路径privatevoidbutton1_Click(objectsender,EventArgse){//从注册表中读取默认浏览器可执行文件路径RegistryKeykey=Registry.ClassesRoot.OpenSubKey(@"http\shell\...
EventArgs e) { foreach (B p in b) { if (p.SName.Equals(text
1.设计一个Windows应用措施,在该措施中首先结构一个学生根基类,在分袂结构小学生、中学生、中职生、大学生等派生类,要求具有差此外特征和行为,能通过静态成员自动记录差此外学生人数。参考界面如下:(1)改削一些控件的属性。(2)核心代码如下:usingSystem;usingSystem.Coll...
EventArgs e) { label1.Text += iplayer.Pre(); } private void
usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows....
EventArgs e){this.source.RemoveAt(0);}//排序 【有问题】private voi
凡是我们在进行数据绑定的时候,常用的数据源有DataSet、DataTable、BindingList<T>、还有强类型数据源。今天我们来通过实例了解一下BindingSource组建,,分享给大家供大家参考借鉴之用。BindingSource的两个用途:(1)首先,它供给一个将窗体上的...
EventArgs e){textBox1.Text = username;textBox2.Text = passw
窗体传值是在学习窗体应用措施时碰到的一类对照常见的问题,现将窗体传值要领做了一点总结,要领如下:<1>声明全局变量传值:在Form1中声明全局变量,如下所示:1publicstaticstringstr="窗体1的值";通过Form1的button1_Click事件即可将此全局变量通报给...
EventArgs e) { Application.Exit(); } private void pictureBo
在C#WinForm中,边框不显示就会造成窗体无法拖动的情况,把下边的代码添加上去就可以解决。1.导入定名空间usingSystem.Runtime.InteropServices;2.输入如下代码[DllImport("user32.dll")]publicstaticexternboolRele...
EventArgs.Empty);}private void OnReceive(object obj){Receiv
usingNewtonsoft.Json;usingNewtonsoft.Json.Linq;usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Linq;usingSystem.Net...
C#之事件与eventArgs
static void Main(string[] args) { MyText myText = new MyText(); myText.Changed += new MyText.ChangedEventHandler(myText_C...
EventArgs e){vScrollBar.focus(); } Winform鼠标滑轮控制自定义滚动条
场景:类似QQ聊天的窗体中,需要添加自界说滚动条vScroll。主窗体中panel存放空间,右边有垂直的滚动条vScroll。问题:已经实现vScroll和Panel.VerticalScroll滚动条联动,但是鼠标滑轮事件不能触发。原因:Panel不能聚焦,,鼠标点击后不能触发wheel事件。解决...
EventArgs e){ // 判断文件名是否为空 if ( string .IsNullOrWhiteSpace(
1、创建和删除目录在c#中涉及到输入、输出(i/o)相关操纵的API都被放在System.IO定名空间下,,或者子命令System.IO.IsolatedStoorage中。对目录进行操纵可以使用Directory类和DirectoryInfo类。Directory类,供给了一些便捷的要领可以辅佐开...
EventArgs e) { var reg = new Regex(“^[0-9]*$”); var str = t
添加keyPress事件,控制键盘输入只能是自然数:代码如下:///<summary>///控制键盘输入只能是自然数///</summary>///<paramname=”sender”></param>///<paramname=”e”>...