随笔分类 -  C#

C#获取键盘的ASSIC
摘要:MssageBox.sho(((int)(e.keychar)).tostring()); 阅读全文

posted @ 2013-07-18 10:25 杨柳清枫2012 阅读(186) 评论(0) 推荐(0)

VS2010中 错误无法嵌入互操作类型“SpeechLib.SpVoiceClass”。请改用适用的接口
摘要:1、提示:在VS2010,在引用COM组件的时候,出现了无法嵌入互操作类型“……”,请改用适用的接口的错误提示。 2、解决方案: 选中项目中引入的dll,鼠标右键,选择属性,把“嵌入互操作类型”设置为False。 阅读全文

posted @ 2013-06-26 23:35 杨柳清枫2012 阅读(719) 评论(0) 推荐(0)

坐标平移,旋转,伸缩
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace 坐标{ public partial class Form1 : Form { public Form1() { InitializeComponent(); ... 阅读全文

posted @ 2013-06-03 22:11 杨柳清枫2012 阅读(215) 评论(0) 推荐(0)

下拉列表框
摘要:View Code using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace 下拉列表框{ public partial class Form1 : Form { public Form1() { InitializeCom... 阅读全文

posted @ 2013-05-13 19:45 杨柳清枫2012 阅读(136) 评论(0) 推荐(0)

panel面板
摘要:View Code using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace 面板{ public partial class Form1 : Form { public Form1() { InitializeCompon... 阅读全文

posted @ 2013-05-13 10:37 杨柳清枫2012 阅读(131) 评论(0) 推荐(0)

numericUpDown
摘要:View Code private void numericUpDown1_ValueChanged(object sender, EventArgs e) { label1.Text = ""; int n = Convert.ToInt32(numericUpDown1.Value); for (int i = 0; i < n;i++) { label1.Text += "@"; } } 阅读全文

posted @ 2013-05-13 10:22 杨柳清枫2012 阅读(109) 评论(0) 推荐(0)

Label 超链接LinkLabel
摘要:View Code using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace 按钮{ public partial class Form1 : Form { public Form1() { InitializeCompon... 阅读全文

posted @ 2013-05-13 10:04 杨柳清枫2012 阅读(283) 评论(0) 推荐(0)

按钮
摘要:Name属性:指示代码中用来标识该对象的名称。AutoSize属性:自动调整自身的大小以适应其内容的大小。BackColor:组件背景色。BackroundIMage:控件的背景图片BackroundIMageLayout 用于组件背景图片的布局。Enabled:是否启用改控件。FlatStyle:用户将鼠标移动到空间上并单击时该控件的外观。Font:用于设置空间中上的文本字体。Text:与控件关联的文本View Code namespace 按钮{ partial class Form1 { /// <summary> /// 必需的设计器变量。 ... 阅读全文

posted @ 2013-05-13 09:35 杨柳清枫2012 阅读(154) 评论(0) 推荐(0)

窗体
摘要:system.windows.forms命名空间中的Application 提供了一系列管理窗口程序的静态方法,比如Run()方法启动程序,用Exit()方法退出程序,用EnableVisualStyles()方法启动应用程序的可视化样式。 阅读全文

posted @ 2013-05-13 09:03 杨柳清枫2012 阅读(120) 评论(0) 推荐(0)

47 异常2
摘要:View Code using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 抛出异常{ class Program { static void Main(string[] args) { try { Console.WriteLine("请输入0-10之间的数"); int number = Convert.ToInt32(C... 阅读全文

posted @ 2013-05-09 21:48 杨柳清枫2012 阅读(91) 评论(0) 推荐(0)

46 异常
摘要:try -catchtry -catch - finallyView Code using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 异常{ class Program { static void Main(string[] args) { Console.WriteLine("请输入分母"); try { int a = Co... 阅读全文

posted @ 2013-05-09 21:04 杨柳清枫2012 阅读(86) 评论(0) 推荐(0)

44 命名空间和 装箱拆箱操作
摘要:namespace作用 用于区分组织不同类View Code using System;/*using System.Collections.Generic;using System.Linq;using System.Text;*/namespace Namespace_1{ class Program { static void Main(string[] args) { //命名空间用于区分和组织的作用。不同的实例引用相应的空间。 A.AA.A a = new A.AA.A(); a... 阅读全文

posted @ 2013-05-09 19:51 杨柳清枫2012 阅读(109) 评论(0) 推荐(0)

43 强数据类型
摘要:View Code using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 类型的判定{ class Program { static void Main(string[] args) { Console.WriteLine("int:"+sizeof(int)); Console.WriteLine("long:" + sizeof(long)); Consol... 阅读全文

posted @ 2013-05-08 23:16 杨柳清枫2012 阅读(181) 评论(0) 推荐(0)

接口的多继承和显示实现
摘要:View Code using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 接口的多继承{ class Program { static void Main(string[] args) { IA a = new C(); a.Breath(); IB b = new C(); b.Breath(); } } cla... 阅读全文

posted @ 2013-05-08 22:25 杨柳清枫2012 阅读(119) 评论(0) 推荐(0)

41 接口的继承
摘要:View Code using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 接口{ class Program { static void Main(string[] args) { IBankAccount account = new Bank();//接口的多态 Izhuanzhang youaccount = new Zk(); account.cunkua... 阅读全文

posted @ 2013-05-08 21:54 杨柳清枫2012 阅读(120) 评论(0) 推荐(0)

40 向下转换 as 定义接口
摘要:View Code using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 向下转换{ class Program { //基类向派生类转换成为向下转换 //用is关键字进行检查, //向下转换如想使用派生类的方法需要进行强制转换 static void Main(string[] args) { B b = new B(); A a = b;... 阅读全文

posted @ 2013-05-08 21:25 杨柳清枫2012 阅读(137) 评论(0) 推荐(0)

39,多态,is运算符
摘要:一个基类的引用符,可以指向多种派生类对象,具有多种不同的形态叫做多态 阅读全文

posted @ 2013-05-07 22:06 杨柳清枫2012 阅读(84) 评论(0) 推荐(0)

38 派生类中的构造函数 object类,ToString
摘要:派生类中的构造函数(有参,无参)、View Code using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Gz{ class Program { static void Main(string[] args) { C abc = new C(); } } class A { private int a; public A() { ... 阅读全文

posted @ 2013-05-07 21:22 杨柳清枫2012 阅读(138) 评论(0) 推荐(0)

37 普通方法隐藏base抽象 密封
摘要:1.普通方法的隐藏,用关键字new .用base关键字调用基类方法。2.抽象类和抽象方法。用关键字 abstrat3.密封类和密封方法。密封类为防止继承。用关键词sealed//抽象方法:只包含方法定义,但没有具体实现的方法,需要其子类或者子类的子类来具体实现。//静态方法不能标记为 override、virtual 或 abstract,即静态方法都必须是具体的//抽象类:含有一个或多个抽象方法的类称为抽象类,在声明时,类名前须添加"abstract"关键字//抽象类中可以包含非抽象方法//抽象类不能够被实例化,这是因为它包含了没有具体实现的方法,即可实例化的类一定不是抽 阅读全文

posted @ 2013-05-07 19:49 杨柳清枫2012 阅读(153) 评论(0) 推荐(0)

36 prodected 虚方法
摘要:public:公共的,可以类的外部被访问private:保护的,只能在类的内部使用,想要在类的外部使用需将改字段或方法放到public方法中、protected:私人的,只能在基类和派生类中使用,类的外不能使用。虚方法:又称多态。发生在基类和派生类之间基类中用:virtual声明。派生类中用:overrid进行重写。重写的方法根据对象的版本进行调用。静态方法不能够被重写 阅读全文

posted @ 2013-05-06 22:45 杨柳清枫2012 阅读(140) 评论(0) 推荐(0)

导航