摘要: private void Yincangtimer_Tick(object sender, EventArgs e)//窗体隐藏事件 { int a =Control.MousePosition.Y;//光标的在屏幕中的 Y 坐标 int b =Control.MousePosition.X;//光标的在屏幕中的 X 坐标 int height =Screen.PrimaryScreen.WorkingArea.Height;//屏幕的高 int width =Screen.PrimaryScreen.WorkingArea.Width;//屏幕的宽 int x =this.Left;//窗体 阅读全文
posted @ 2013-02-19 20:16 乡香田甜 阅读(709) 评论(0) 推荐(0) 编辑
摘要: 数据转换,实现double转换成整型,浮点型,字符串型 /// <summary> /// 数据转换,实现double转换成整型,浮点型,字符串型 /// </summary> class Program { static void Main(string[] args) { double mydouble = 87.45;//原始数据 int myint; float myfloat; string myString; myint = Convert.ToInt32(mydouble); myfloat = Convert.ToSingle(mydouble); my 阅读全文
posted @ 2013-02-19 20:09 乡香田甜 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 注:希望能全部完整输出,而不是逐个输出static void Main(string[] args) { int inPutNumber = int.Parse(Console.ReadLine()); do { string current = ""; int Model = inPutNumber % 8; inPutNumber/= 8; int intTemp = '0' + Model... 阅读全文
posted @ 2013-02-19 20:05 乡香田甜 阅读(322) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { string strResult = ""; try { Console.WriteLine("请输入数字A:"); ... 阅读全文
posted @ 2013-02-19 20:02 乡香田甜 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 原理:基类可以定义并实现虚(virtual)方法,派生类可以重写(override)这些方法实例代码:class Shape { // public int X{get;private set; } public int Y{get;private set;} public int Height{get;set;} public int Width{get;set;} // public virtual void Draw() { Console.WriteLine("Performing base class drawing tasks"); } } class Circ 阅读全文
posted @ 2013-02-19 19:54 乡香田甜 阅读(341) 评论(0) 推荐(0) 编辑
摘要: 首先是主窗体部分,即要判断窗体的状态来决定是否显示悬浮窗口。局部成员声明:private FormWindowState fwsPrevious;private frmTopMost myTopMost;主窗体的Load事件:private void frmMain_Load(object sender, System.EventArgs e){// Save window statefwsPrevious = this.WindowState;// Create top most windowmyTopMost = new frmTopMost( this );} 主窗体的SizeChang 阅读全文
posted @ 2013-02-19 19:02 乡香田甜 阅读(696) 评论(0) 推荐(0) 编辑
摘要: 技术:熟练String 类的Format()方法代码: class Program { static void Main(string[] args) { string name; int sex; string age; int height; string xuexing; string star; string favfood; Console.WriteLine("请输入你的姓名... 阅读全文
posted @ 2013-02-19 19:00 乡香田甜 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 技术:字符串的常用处理方法,及do..while代码: /// <summary> /// 演示字符串的常用处理方法,从邮箱地址中提取用户名 /// </summary> class Program { static void Main(string[] args) { string choice=""; do { string EmailName = ""; Console.WriteLine("请输入你邮箱地... 阅读全文
posted @ 2013-02-19 18:58 乡香田甜 阅读(584) 评论(0) 推荐(0) 编辑
摘要: namespace ConsoleDemo{ /// <summary> /// 双层循环实现冒泡排序 /// </summary> class Program { static void Main(string[] args) { SortedNumbers(); } /// <summary> /// 该方法获得需要排序的数组,表调用排序方法进行排序 /// </summary> public static void SortedNumbers() { int numberCount; int[] numbers; Console.Write 阅读全文
posted @ 2013-02-19 18:54 乡香田甜 阅读(902) 评论(0) 推荐(0) 编辑
摘要: 值参数:当利用值向方法传递参数时,编译程序给实参的值做一份拷贝,并且将此拷贝传递给该方法,被调用的方法不会修改内存中实参的值,所以使用值参数时,可以保证实际值是安全的,在调用方法时,如果形式化参数的类型是值参数的话,调用的实参的表达式必须保证是正确的值表达式publicclassClass1{staticvoidswap(intx,inty){inttemp=x;x=y;y=temp;}staticvoidMain(){inti,j;i=1;j=2;swap(i,j);Console.WriteLine("i 及 j的值分别为{0},{1}",i,j);}}输出结果为1,2 阅读全文
posted @ 2013-02-19 18:32 乡香田甜 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 通过Button打开一个对话框,选择一个文件,在TextBox中显示文件的绝对路径private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { txtPath.Text = ofd.FileName; } }窗体中通过代码添加按钮的背景颜色pu... 阅读全文
posted @ 2013-02-19 18:14 乡香田甜 阅读(1941) 评论(0) 推荐(0) 编辑
摘要: 隐式转换,和显示转换 Checked (可能溢出时加上这个关键词)与uncheckedusing System;using System.Windows.Forms;class Conversions{ static void Main() { int a=5; long b; b=a;//隐式转换 Console.WriteLine(b); long c=5; int d; d=(int)c;//显示转换 Console.WriteLine(d); Co... 阅读全文
posted @ 2013-02-19 17:15 乡香田甜 阅读(440) 评论(0) 推荐(0) 编辑
摘要: 集合:成功解决方案储备 阅读全文
posted @ 2013-02-19 14:21 乡香田甜 阅读(171) 评论(0) 推荐(0) 编辑
摘要: C# 系统配制技巧全集 阅读全文
posted @ 2013-02-19 14:17 乡香田甜 阅读(401) 评论(0) 推荐(0) 编辑
摘要: 应用: TimeSpan ts =Convert.ToDateTime(serModel.EndDate).Subtract(Convert.ToDateTime(serModel.SatrtDate));serModel.ExecuteTrimLenght = Convert.ToInt32(ts.TotalSeconds);源码:1)(dt1 - dt2).TotalSecondsor dt1.Subtract(dt2).TotalSeconds2)要是想在C#中,就这么做, datatime d1=new datatime(2007,8,12,2,36,35); datatime... 阅读全文
posted @ 2013-02-19 11:27 乡香田甜 阅读(197) 评论(0) 推荐(0) 编辑
摘要: C#验证:限制TextBox只能输入数字并控制输入数字的长度 阅读全文
posted @ 2013-02-19 11:06 乡香田甜 阅读(2424) 评论(0) 推荐(0) 编辑
摘要: TcpClient和TcpListener 类的使用-编写一个点对点聊天工具(初级入门篇) 阅读全文
posted @ 2013-02-19 09:58 乡香田甜 阅读(683) 评论(0) 推荐(0) 编辑