luckapple2

2011年6月2日 #

c#中常会涉及到一些类,List的深度拷贝。

 public object Clone(object ldc)
        {
            BinaryFormatter Formatter = new BinaryFormatter();
            MemoryStream stream = new MemoryStream();
            Formatter.Serialize(stream, ldc);
            stream.Position = 0;
            object clonedObj = Formatter.Deserialize(stream);
            stream.Close();
            return clonedObj;
        }

posted @ 2011-06-02 11:07 luckapple2 阅读(136) 评论(0) 编辑

2011年5月11日 #

使用outllok发送邮件。

调用OUTLOOK预研。用于发送邮件。
参考msdn上http://msdn.microsoft.com/zh-cn/library/ms269113(v=VS.80).aspx#Y325
http://msdn.microsoft.com/zh-cn/library/ms268893(VS.80).aspx
添加一个引用,命名空间Microsoft.Office.Interop.Outlook;
 ApplicationClass outLookApp = new ApplicationClass();
            MailItem newMail = (MailItem)outLookApp.CreateItem(OlItemType.olMailItem);
            newMail.To = "fengzhk@foxmail.com";
            newMail.Body  = "test内容";
            newMail.CC = "fengzhaokui@163.com";
            newMail.Subject = "biaoti主题";
            newMail.Display();//弹出outlook
            //newMail.Send();//直接发送。不弹出outlook

posted @ 2011-05-11 15:09 luckapple2 阅读(16) 评论(0) 编辑

2010年12月23日 #

wpf Command Binding

http://www.cnblogs.com/gaixiaojie/archive/2010/09/01/1815015.html?login=1#commentform

posted @ 2010-12-23 10:57 luckapple2 阅读(32) 评论(0) 编辑

2010年8月17日 #

装饰者模式

http://www.cnblogs.com/qinbaobei/archive/2010/05/04/1727383.html

http://www.cnblogs.com/justinw/archive/2007/06/11/779356.html

posted @ 2010-08-17 13:35 luckapple2 阅读(18) 评论(0) 编辑

2010年8月5日 #

c#调用c++dll

 

 const string sdllPath = "TaskEdit.dll";
        [DllImport(sdllPath)]
        internal static extern IntPtr NewTask();
        [DllImport(sdllPath)]
      
        internal static extern IntPtr EditTask(string a, int b, int c, string d, string e, string f, string g);

        [DllImport(sdllPath)]
        internal static extern IntPtr ReadTask(string a, int b, int c, string d, string e, string f, string g);

        [DllImport(sdllPath)]
        internal static extern IntPtr GetTaskData(ref string a, ref int b, ref int c, ref string d, ref string e, ref string f, ref string g);
        [DllImport(sdllPath)]
        internal static extern IntPtr OpenANMapEdit(int nTaskId, string pcVersion, int nEditMode, int nWorkMode, string pcPicNo, string pcAdminNo, string pcRange, string pcPicLyer);

 

DllImport只接受常量const。那么我可以把dll的路径写到环境变量里并重新运行程序就可以找到了。(如用vs运行的话需要重启vs。)

 

posted @ 2010-08-05 11:41 luckapple2 阅读(128) 评论(0) 编辑

2009年11月10日 #

wpf中鼠标拖动控件移动

摘要: xaml:<Canvas Name="canvas2" > <Canvas Background="Yellow" Canvas.Left="40" Canvas.Top="20" Width="100" Name="canvas1" Height="54" > <Thumb Name="thumb" Height="20" DragDelta="Thumb_Drag...阅读全文

posted @ 2009-11-10 15:09 luckapple2 阅读(1088) 评论(0) 编辑

2009年11月9日 #

wpf中textblock竖立显示文本

摘要: xaml<TextBlock HorizontalAlignment="Left" Text="竖立显示文本" Name="textBlock1" Width="92" />csstring s = textBlock1.Text; int a = s.Length; textBlock1.Text = ""; for (int i = 0; i < a; i++) { Run ...阅读全文

posted @ 2009-11-09 22:21 luckapple2 阅读(208) 评论(1) 编辑

2009年7月17日 #

重新开博

摘要: wpf如何在一个解决方案里只设有一个资源文件,所有得工程集统一调用这个资源文件。现在我想到得办法是在跟资源文件不在一个工程集中使用资源时调用资源改用动态的DynamicResource调用,这样一来错是不会报了,但是编辑界面时没法看到资源的作用。阅读全文

posted @ 2009-07-17 17:59 luckapple2 阅读(40) 评论(0) 编辑

2009年3月22日 #

3.22

posted @ 2009-03-22 23:02 luckapple2 阅读(34) 评论(0) 编辑

2009年1月1日 #

2009

posted @ 2009-01-01 01:22 luckapple2 阅读(27) 评论(0) 编辑

仅列出标题  下一页

My Links

Blog Stats

News