随笔分类 -  C# 独立功能模块集

1
C# 独立功能模块 主要针对 C#的WinForm开发
摘要:http://www.cnblogs.com/luomingui/archive/2011/12/31/2308721.htmlhttp://tech.ddvip.com/2012-09/1347462988181868.html 阅读全文
posted @ 2013-12-27 21:22 乡香田甜 阅读(250) 评论(0) 推荐(0)
摘要:using System.Runtime.InteropServices;static void Main(string[] args) { System.Console.WriteLine(System.Environment.OSVersion); System.Console.WriteLine(System.Threading.Thread.CurrentThread.CurrentCulture.ThreeLetterWindowsLanguageName); System.Console.WriteLi... 阅读全文
posted @ 2013-11-15 16:06 乡香田甜 阅读(1018) 评论(0) 推荐(0)
摘要:c#如何用代码开启cmd指定命令(如:运行一个手机adb shell命令) 阅读全文
posted @ 2013-10-12 10:36 乡香田甜 阅读(2234) 评论(0) 推荐(0)
摘要:实例:在c#中 在D盘下面创建一个abc的文件夹,然后在文件夹里面创建一个123.txt的文档string path = @"D:\abc";string fileName = "123.txt";if (!Directory.Exists(path)){Directory.CreateDirectory(path);}if (!File.Exists(path + "\\" + fileName)){File.Create(path + "\\" + fileName);} 阅读全文
posted @ 2013-09-05 17:06 乡香田甜 阅读(354) 评论(0) 推荐(0)
摘要:C# 检测dll的新版本号方法 阅读全文
posted @ 2013-08-28 08:40 乡香田甜 阅读(647) 评论(0) 推荐(0)
摘要:void dataGridView1_Click(object sender, EventArgs e) { M_int_judge = 1; btnSave.Enabled = true; btnSave.BackColor = this.BackColor; btnDelete.Enabled = true; btnDelete.BackColor = this.BackColor; txtUserID.Text = Convert.ToStr... 阅读全文
posted @ 2013-07-30 14:09 乡香田甜 阅读(495) 评论(0) 推荐(0)
摘要:将整个文件夹复制到目标文件夹中。 阅读全文
posted @ 2013-07-17 17:43 乡香田甜 阅读(614) 评论(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.Threading.Tasks;using System.Windows.Forms;namespace Demo{ public partial class FormDataTable : Form { public FormDataTable()... 阅读全文
posted @ 2013-05-06 13:44 乡香田甜 阅读(462) 评论(0) 推荐(0)
摘要:System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start();//要测试的代码 sw.Stop(); Console.WriteLine(sw.Elapsed.ToString());//在输出窗口中查看你也可以自己改来输出到页面查看实例代码测试结果: 阅读全文
posted @ 2013-05-03 16:20 乡香田甜 阅读(587) 评论(0) 推荐(0)
摘要:设置: checkedListBox1.HorizontalScrollbar=true;DevExpress.XtraEditors.CheckedListBoxControl 因为控件属性中一直找不到该属性需要在代代码中手工添加.(这也是我贴出来的原因,呜呜,找这个属性耗了我不少时间) public partial class Form1 : Form { public Form1() { InitializeComponent(); DisplayHScroll(); } //... 阅读全文
posted @ 2013-03-20 15:34 乡香田甜 阅读(1611) 评论(0) 推荐(0)
摘要:/// <summary> /// C#读取不在同一个程序集中的配置文件(代码没验证??) /// </summary> public static string ReportTemplateDirectory { get { string fileName =Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Mobot.TeamFoundation.Client.Win.exe.config"... 阅读全文
posted @ 2013-03-04 09:01 乡香田甜 阅读(622) 评论(0) 推荐(0)
摘要: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 乡香田甜 阅读(744) 评论(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 乡香田甜 阅读(206) 评论(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 乡香田甜 阅读(736) 评论(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 乡香田甜 阅读(209) 评论(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 乡香田甜 阅读(613) 评论(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 乡香田甜 阅读(919) 评论(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 乡香田甜 阅读(210) 评论(0) 推荐(0)
摘要:窗体不可移动 C# WinForm 阅读全文
posted @ 2013-02-18 10:12 乡香田甜 阅读(556) 评论(0) 推荐(0)
摘要:打开另一程序 程序重启 Process类 c#如何用一个程序打开另一个程序(如:窗体的注销重启) 阅读全文
posted @ 2012-12-28 10:45 乡香田甜 阅读(1247) 评论(0) 推荐(0)

1