摘要:
WorkState public enum WorkState { Ready, Running, Completed }IWork public interface IWork { WorkState State { get; set; } void Perform(); }关键类WorkQueuepublic class WorkQueue { private List _vlstWork = new List(); public void Add(IWork work) { lock (this) { _vlstWork.Add(work); } } public int GetCoun 阅读全文
随笔分类 - C#
(转)颠覆你对方法调用的看法!
2013-10-19 11:08 by hongjiumu, 270 阅读, 收藏,
摘要:
颠覆你对方法调用的看法!http://www.cnblogs.com/francisYoung/p/3371106.html注意:如果你是一个初学者,对实例方法,虚方法的调用还不太清楚,强烈建议你不要阅读本文,因为这里面的代码会让你完全崩溃掉。如果你对实例方法,虚方法的运行机制已经了如指掌,并且,对方法和对象的内存布局也心中有数,那么本文可能会颠覆你以前对他们的认识。阅读本文的最佳方式就是亲自演练一下,如果看完之后有疑惑,那么是正常的,但是稍加思考就会想明白。我说,string变量可以直接引用一个object对象!我说,派生类型的变量可以直接引用基类型的对象!你会说,老兄,别开玩笑了,派生类型 阅读全文
TabControl控件和TabPage
2013-10-19 11:05 by hongjiumu, 1122 阅读, 收藏,
摘要:
TabControl控件和TabPageTabControl控件可以支持在一个控件里面放置多个选项卡,每个选项卡又可以放置多个控件由于在控件属性窗口添加选项卡相对比较容易,下面说一下动态创建选项卡首先从工具栏拖入一个TabControl控件tabControl1//创建一个TabPageTabPage tabPage = new TabPage();//设置选项卡文本tabPage.Text = "选项卡1";//选项卡名字(可以通过这个名字来访问到tabControl1中的选项卡)tabPage.Name = "page1";//如果选项卡内的控件比较 阅读全文
GridControl事件
2013-10-19 11:04 by hongjiumu, 896 阅读, 收藏,
摘要:
private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { if (e.Button == MouseButtons.Left) { //鼠标的那个按钮按下 } if (e.Clicks == 2) { //鼠标点击次数 ... 阅读全文
c# 简单又好用的四舍五入方法
2013-09-03 20:37 by hongjiumu, 4761 阅读, 收藏,
摘要:
http://www.soaspx.com/dotnet/csharp/csharp_20100415_3809.html四舍五入是软件开发中经常遇到的问题,我也在不止一个项目中用到这方面的运算;关于c#的四舍五入,如果你去网上搜会有好多结果,但大部分的内容都是说微软的Math.Round() 不准确,属于“四舍六入五成双”,然后会有很多人自己去写方法来实现,有的很简单,有的很复杂,有的还不对;其实要实现这个功能,真的不用这么麻烦;大家既然知道c#有Math.Round(),难道就没发现它有多大8个重载方法吗,其中有一个类型是MidpointRounding的参数,只要我们很好的利用它,就完全 阅读全文
CLR Profiler
2013-07-11 22:38 by hongjiumu, 188 阅读, 收藏,
摘要:
使用CLR Profiler分析.NET程序内存不断上升的图文教程http://www.cr173.com/html/17930_1.html#The Why and How of .NET Profilinghttps://www.simple-talk.com/dotnet/performance/the-why-and-how-of-.net-profiling/http://www.cnblogs.com/coolkiss/archive/2010/08/20/1804705.html 阅读全文
读写配置文件
2013-06-19 22:14 by hongjiumu, 226 阅读, 收藏,
摘要:
写配置文件public void WriteConfigurationFile(string path) { using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(path, true)) { if (_vdtSource == null || _vdtSource.Rows.Count == 0) { return; }... 阅读全文
想办法处理gridControl行中的checkedit事件
2013-06-01 12:06 by hongjiumu, 2116 阅读, 收藏,
摘要:
想办法处理gridControl行中的checkedit事件:private void Reorganize(){ GridControl gridControl = gridControl1; DevExpress.XtraGrid.Columns.GridColumn checkColumn = ((ColumnView)gridControl.Views[0]).Columns["Checked"]; RepositoryItemCheckEdit et = new RepositoryItemCheckEdit(); checkColumn.ColumnEdit.. 阅读全文
删除datatable的重复行
2013-04-25 23:31 by hongjiumu, 343 阅读, 收藏,
摘要:
删除datatable的重复行private void RemoveRepeat(ref System.Data.DataTable dataTableSource) { List<string> list = new List<string>(); StringBuilder builder = null; System.Data.DataRow currenDr = null; string currentStr = string.Empty; for (int i ... 阅读全文
导出大Excel
2013-04-25 23:30 by hongjiumu, 296 阅读, 收藏,
摘要:
public static void Export(string filePath,string strSql){ ExcelApp.Application excelApp = new ExcelApp.Application(); ExcelApp._Workbook workbook = excelApp.Workbooks.Add(); try { workbook.Activate(); ExcelApp._Worksheet worksheet = workbook.Worksheets.Add(); string ... 阅读全文
System.AppDomain.CurrentDomain.BaseDirectory总是取得根目录
2013-04-21 10:37 by hongjiumu, 624 阅读, 收藏,
摘要:
System.AppDomain.CurrentDomain.BaseDirectory总是取得根目录 阅读全文
open the folder
2013-04-21 10:36 by hongjiumu, 276 阅读, 收藏,
摘要:
private void OpenFolder(string path){ string windir = Environment.GetEnvironmentVariable("WINDIR"); System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo.FileName = windir + @"\explorer.exe"; process.StartInfo.Arguments = path; process.Start();} 阅读全文
winform调用plugin
2013-04-20 22:45 by hongjiumu, 365 阅读, 收藏,
摘要:
winform插件开发:try { System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom(Application.StartupPath + "\\Kuwait2GNSNForms.dll"); Type[] types = assembly.GetTypes(); foreach (Type type in types) { ... 阅读全文
console调用plugin
2013-04-20 22:44 by hongjiumu, 267 阅读, 收藏,
摘要:
插件设计using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows.Forms; namespace ConsoleApplication1{ class Program { private static string _vsPath = @"D:\work\0411\test\Solution2\WindowsFormsApplicationTest\bin\Debug\WindowsFormsApplicationTes... 阅读全文
最简单的日志
2013-04-06 22:49 by hongjiumu, 167 阅读, 收藏,
摘要:
最简单的日志:public class Logger{ public static void Trace(string title,string message) { string path = System.Windows.Forms.Application.StartupPath + "\\Log.txt"; StreamWriter sw = new StreamWriter(path,true); sw.Write("{0}:{1}", title, message); sw.Flush(); sw.C... 阅读全文
Current thread must be set to single thread apartment (STA) mode before OLE
2013-04-06 22:44 by hongjiumu, 1348 阅读, 收藏,
摘要:
Current thread must be set to single thread apartment (STA) mode before OLE原因很简单:就是有assembly的project,又有同名的winform的exe.net在运行的时候调用异常啊! 阅读全文
Dev chartControl添加提示层信息
2013-03-18 22:12 by hongjiumu, 1179 阅读, 收藏,
摘要:
//Add the Information.this.chartControlParameter.ObjectHotTracked += (s, a) => {//ChartHitInfo chartHitInfo = a.HitInfo;SeriesPoint seriesPoint = a.AdditionalObject as SeriesPoint;if (seriesPoint != null){//MessageBox.Show(seriesPoint.Argument);toolTipControllerParameter.ShowHint(seriesPoint.Argu 阅读全文
aspose读Excel
2013-03-15 22:11 by hongjiumu, 2646 阅读, 收藏,
摘要:
private string ReadExcelCell(string path, int row, int column) { Workbook workbook = new Workbook(); workbook.Open(path); Cells cells = workbook.Worksheets[0].Cells; for (int i = 0; i < cells.MaxDataRow + 1; i++) { if (i ... 阅读全文
A Simple Plug-In Library For .NET
2013-03-15 22:09 by hongjiumu, 208 阅读, 收藏,
摘要:
A Simple Plug-In Library For .NEThttp://www.codeproject.com/Articles/182970/A-Simple-Plug-In-Library-For-NET 阅读全文
浙公网安备 33010602011771号