随笔分类 -  C#

摘要:在WinForm中可以使用WPF中的控件,或者由WPF创建的自定义控件;步骤1:创建WinForm工程;步骤2:在WinForm工程的解决方案资源管理器中,在刚刚创建的WinForm解决方案中新建或者添加现有的WPF用户控件工程;步骤3:在WPF中创建自定义的控件,或者添加WPF控件到面板上;步骤4:在WinForm面板上添加ElementHost控件(工具箱中);步骤5:生成解决方案;步骤6:在刚刚的ElementHost中的Child属性中添加刚刚的WPF生成的控件;步骤7:完成。如果在ElementHost的Child属性中添加了WPF生成的控件,编译的时候出现如下错误:错误 1 类型“ 阅读全文
posted @ 2012-09-04 21:14 Jezze 阅读(15440) 评论(0) 推荐(2)
摘要:转自:http://www.arasplm.net/index.php/zh/community/myblog/c-xx-.html前些天做的要使用到线程的项目,现在和大家分享一下感受!以下面小列子为例,给出这个问题的解决办法。下面的列子是以一个计数器为列讲解的。public Form1(){InitializeComponent();}private void btnStart_Click(object sender, EventArgs e){// 创建线程Thread newThread = new Thread(new ThreadStart(Count)); newThread.St 阅读全文
posted @ 2012-08-30 11:46 Jezze 阅读(29231) 评论(1) 推荐(2)
摘要:刚学GDI+画图的时候,画线就是画不出来,代码如下: public Form1(){InitializeComponent();Graphics g = this.CreateGraphics();Pen p = new Pen(Color.Black);g.DrawLine(p, 10, 10, 20, 20);}应改为public Form1(){InitializeComponent()... 阅读全文
posted @ 2011-12-23 18:29 Jezze 阅读(9773) 评论(0) 推荐(1)
摘要:1、Thread td = new Thread(new ThreadStart(delegate() { DoSomeThing(参数); })); td.Start(); 2、Thread td = new Thread(new ParameterizedThreadStart(DoSome)); td.Start(参数); 这里DoSome的形式只能为DoSome(object o ); 传... 阅读全文
posted @ 2011-12-23 18:28 Jezze 阅读(1237) 评论(0) 推荐(0)