2012年5月3日

DLL is attempting managed execution inside OS Loader lock 解决

摘要: DLL 'bin/Debug/Microsoft.DirectX.DirectSound.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.至于为什么会出现这个异常,看到某个人的解释是 MS的 Bug,不过可以不显示这个异常,具体方法如下:菜单栏 阅读全文

posted @ 2012-05-03 13:07 恒波 阅读(522) 评论(0) 推荐(0) 编辑

2011年12月19日

C#中SerialPort类对串口供电需要设置DtrEnable 和RtsEnable 两个属性

摘要: 在开发中有些串口设备需要串口供电,使用C#中的SerialPort类默认情况下不会出发 DataReceived函数,但使用超级终端却可以接收到数据,这是因为 SerialPort 类的DtrEnable 和RtsEnable 两个属性默认是false,设为true即可接收数据了,如下: this.m_SerialPort.DtrEnable = true; //启用控制终端就续信号 this.m_SerialPort.RtsEnable = true; //启用请求发送信号 阅读全文

posted @ 2011-12-19 13:34 恒波 阅读(8443) 评论(1) 推荐(1) 编辑

2011年11月25日

c# 数据类型格式转换大全

摘要: 1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=currentTime.Month; 1.4 取当前日 int 日=currentTime.Day; 1.5 取当前时 int 时=currentTime.Hour; 1.6 取当前分 int 分=currentTime.Minute; 1.7 取当前秒 int... 阅读全文

posted @ 2011-11-25 10:40 恒波 阅读(5360) 评论(1) 推荐(0) 编辑

2011年11月24日

两个类是否相等

摘要: 例如你有一个类如下:public class Class1{private int m;private string n; public int M { set { m = value; } get { return m; } } public string N { set { n = value; } get { return n; } }public override bool Equals(object obj){ Class1 anotherClass = obj as Class1;if (anotherClass != null) return( this.m == another 阅读全文

posted @ 2011-11-24 08:58 恒波 阅读(617) 评论(0) 推荐(0) 编辑

2011年11月22日

WPF MVVM Model类序列化

摘要: 今天写代码,碰到如下问题:因为采用了MVVM,需要将Model类序列化,总是出错..写了一个可序列化的类,此类继承INotifyPropertyChanged接口,需要实现事件:public event PropertyChangedEventHandler PropertyChanged;编译通过,但在序列化的时候,报错“程序集“WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”中的类型“System.ComponentModel.PropertyChangedEventManager 阅读全文

posted @ 2011-11-22 11:47 恒波 阅读(1735) 评论(1) 推荐(0) 编辑

2011年11月2日

3D 界面切换

摘要: 今天由于项目需要,使用了3D界面的切换,看了很多例子,把图片的3D切换改成了,界面的切换.CS内容:using System;using System.Collections.Generic;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Med 阅读全文

posted @ 2011-11-02 17:29 恒波 阅读(2148) 评论(0) 推荐(0) 编辑

C# 4.0 新增特性

摘要: 之前的文章中,我们曾介绍过C#的历史及C#4.0新增特性,包括:dynamic、 命名和可选参数、动态导入以及协变和逆变等。今天我们结合代码实例来具体看一下C#4.0中的四个比较重要的特性。 1.dynamic ExpandoObject 熟悉js的朋友都知道js可以这么写 :var t=newObject(); t.Abc=‘something’; t.Value=243; 现在这个js动态语言的特性,我们也可以在c#中使用了,前提是将一个变量声明为ExpandoObject类型。如下例: staticvoidMain(string[] args) { dynamic t=newEx... 阅读全文

posted @ 2011-11-02 09:48 恒波 阅读(328) 评论(0) 推荐(0) 编辑

WPF 按钮样式

摘要: 项目中用到的WPF 按钮样式,,, <!--定义按钮样式--> <Style TargetType="Button"> <Setter Property="Foreground" Value="Black"/> <!--修改模板属性--> <Setter Property="Template"> <Setter.Value> <!--控件模板--> <ControlTemplate TargetType="Butto 阅读全文

posted @ 2011-11-02 09:24 恒波 阅读(16125) 评论(0) 推荐(2) 编辑

透明按钮 控件

摘要: 透明按钮 控件...using System;using System.ComponentModel;using System.Drawing;using System.Drawing.Drawing2D;using System.Windows.Forms;namespace GlassButton{ #region//控件状态 ///<summary> /// 控件状态 ///</summary> public enum State { ///<summary> /// 无 ///</summary> ... 阅读全文

posted @ 2011-11-02 09:16 恒波 阅读(800) 评论(0) 推荐(0) 编辑

2011年10月30日

博客开通了..

摘要: 这段时间一直在做WPF的项目,在博客园找到很多想要的资料,所以也萌生出申请博客,把自己的东西也分享一下,供大家分享。也希望能交到更多的朋友,,谢谢..... 阅读全文

posted @ 2011-10-30 11:49 恒波 阅读(118) 评论(0) 推荐(0) 编辑

导航