摘要: 最近做一个项目,对方公司只提供了一个c++的DLL,但没封住,c#无法DllImport.所以只能自己写c++来封住了。对方的Dll只接收yuv420的图片格式,所以在c++里用opencv来转换。本来想C#来写,但总觉得麻烦。【C#】代码public void Do(Bitmap bp){ Bit... 阅读全文
posted @ 2015-05-25 02:40 qiurideyun 阅读(2003) 评论(0) 推荐(1) 编辑
摘要: c# clone Class one:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApplication2{ class Program { static void Main(string[] args) { DemoClass demoClass = new DemoClass(); demoClas... 阅读全文
posted @ 2013-02-10 19:00 qiurideyun 阅读(437) 评论(0) 推荐(0) 编辑
摘要: 之前的项目需要镜像翻转摄像头视频,使用Aforge.Net来处理视频。一开始考虑直接从Aforge.Net读取没一帧视频图片,然后复制给WPF的Image控件,这种方法基本很卡,所以放弃了。考虑到Aforge.net 返回的图片是Bitmap的,所以打算直接在WPF中嵌入Winform的pictur... 阅读全文
posted @ 2015-05-25 23:11 qiurideyun 阅读(2628) 评论(5) 推荐(0) 编辑
摘要: 我们在开发的时候,经常要写文件的头,和一些版本的申明。大多数文件时相同的,这时我们就需要C#提供的自定义模版。Let's go我们来定义自己的cs文件模版先建立一个Console Application接着我们在MyCSClass这个类中定义模版下面是模版中可以使用的参数(对于的意义)clrversion公共语言运行时 (CLR) 的当前版本。GUID [1-10]用于替换项目文件中的项目 GUID 的 GUID。 最多可以指定 10 个唯一的 GUID(例如,guid1))。itemname用户在添加新项对话框中提供的名称。machinename当前的计算机名称(例如,Compute 阅读全文
posted @ 2013-03-21 19:14 qiurideyun 阅读(970) 评论(1) 推荐(1) 编辑
摘要: 关于事件的订阅和发布,相信网上已经有很多版本了。基本的原理就是先订阅事件,将订阅的事件保存到特定的容器中,接着,当发布事件的时候,直接调用的保存的事件。.NET不是已经提供了Event,为什么还要做事件的订阅和发布。我个人的理解是高度封装自己的事件,这样代码简洁美观,并且易于维护和扩展。我采用了静态的容器来保存订阅的事件,这样可以跨组建或项目的程序集。首先我们要定义我们自己的Event事件using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading 阅读全文
posted @ 2013-02-28 19:52 qiurideyun 阅读(1597) 评论(0) 推荐(0) 编辑
摘要: 再这里感谢john_masen同学。Lambda Expression还是比较繁琐。使用CallMemberName重写 NotifyObjectNotifyObject代码:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.ComponentModel;using System.Linq.Expressions;using System.Runtime.CompilerServices;names 阅读全文
posted @ 2013-02-16 14:20 qiurideyun 阅读(1543) 评论(0) 推荐(0) 编辑
摘要: Convert在WPF页面显示中,使用比较多。今天就来瞎想下Convert1.先来个最常用的 bool 转 VisibleXAML代码:<Window x:Class="WpfApplication4.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:local="clr-namespace:WpfApplication4" xmlns:x="http://schemas.microsoft.com/w 阅读全文
posted @ 2013-02-15 21:05 qiurideyun 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 动态控件添加,基本UI开发都需要使用。我看过很多人写,都停留在WinFrom开发时代的直接操作控件来实现动态添加控件。到了WPF依然很多人在这样操作。(不是说这样写错误,但是这违背了UI和逻辑分离的思想,不利于后期维护。深有体会。当看到后台密密麻麻的添加子控件,心情瞬间崩溃)我们先来看下UI和逻辑不分离的代码(简单粗暴实现代码):XAML代码:<Window x:Class="WpfApplication4.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation 阅读全文
posted @ 2013-02-15 15:56 qiurideyun 阅读(735) 评论(0) 推荐(0) 编辑
摘要: DataTemplate可以说是WPF的灵魂之一。可以灵活的定制样式和动态添加控件。今天先来了解DataTemplate通常使用(DataGrid的DataTemplate)(代码中有些方法,你可以参考之前的blog)XAML的代码:<Window x:Class="WpfApplication4.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:local="clr-namespace:WpfApplication4&q 阅读全文
posted @ 2013-02-15 15:09 qiurideyun 阅读(548) 评论(0) 推荐(0) 编辑
摘要: 之前的NotifyObjec有问题。是多个属性同时对一个Object进行操作。新代码如下。using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.ComponentModel;using System.Linq.Expressions;namespace WpfApplication4{ public abstract class NotifyObject:INotifyPropertyChange... 阅读全文
posted @ 2013-02-15 14:25 qiurideyun 阅读(1341) 评论(0) 推荐(1) 编辑
摘要: WPF的使用都离不开这个接口。这个接口实现当ViewModel的数据发生变化的时候,通知前台页面的功能;通常我们的ViewModel的写法都是这样的。Look:下面的代码using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.ComponentModel;namespace WpfApplication4{ public class DemoViewModel:INotifyPropertyChan... 阅读全文
posted @ 2013-02-14 21:19 qiurideyun 阅读(1496) 评论(2) 推荐(0) 编辑