2014年3月29日
摘要: static void Main(string[] args) { string[] strArr;//参数列表 string sArguments = @"Pythons.py";//这里是python的文件名字 RunPythonScript(sArguments, "-u", strArr); }public static void RunPythonScript(string sArgName, string args = "",params string[] teps) {... 阅读全文
posted @ 2014-03-29 12:22 武胜-阿伟 阅读(8368) 评论(0) 推荐(1) 编辑
摘要: Cursor.Current = Cursors.WaitCursor;Process process = new Process();//不显示 console 窗口 process.StartInfo.RedirectStandardOutput = true; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.StartInfo.FileName = @"C:\Python27\Python.exe"; process.Star... 阅读全文
posted @ 2014-03-29 12:17 武胜-阿伟 阅读(1124) 评论(0) 推荐(0) 编辑
摘要: The sample code below will remove all Click events from button1public partial class Form1 : Form{ public Form1() { InitializeComponent(); button1.Click += button1_Click; button1.Click += button1_Click2; button2.Click += button2_Click; ... 阅读全文
posted @ 2014-03-29 10:50 武胜-阿伟 阅读(468) 评论(0) 推荐(0) 编辑
摘要: var btn2 =newButton(); btn2.Text= btn1.Text;btn2.size = btn1.size;To clone all events of any WinForms control:var eventsField =typeof(Component).GetField("events",BindingFlags.NonPublic|BindingFlags.Instance);var eventHandlerList = eventsField.GetValue(button1);eventsField.SetValue(button2 阅读全文
posted @ 2014-03-29 10:45 武胜-阿伟 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 写一个类时,有时候会在同一个类上添加很多事件,事件很多的话,是不容易管理的,.NET提供的EventHandlerList可以辅助多个事件的管 理,但不方便的地方是,它不是类型安全的,缺少类型安全,多少用起来担心会出错。经过改造,可以将系统提供的EventHandlerList通 过泛型提供类型安全的管理。泛型类EventHandlerList.cs的实现如下:public sealed class EventHandlerList : IDisposable { ListEntry head; public EventHandlerList() ... 阅读全文
posted @ 2014-03-29 10:24 武胜-阿伟 阅读(326) 评论(0) 推荐(0) 编辑