随笔分类 -  C#

自定义的 ListBoxItem 自适应ListBox的宽度
摘要:主要是要设置HorizontalContentAlignment的值,而不是HorizontalAlignment @thl 2014年2月14日 13:55:24 阅读全文

posted @ 2014-02-14 13:57 软件部 阅读(2690) 评论(0) 推荐(0)

GDI+中发生一般性错误的解决办法(转帖)
摘要:今天在开发.net引用程序中,需要System.Drawing.Image.Save 创建图片,debug的时候程序一切正常,可是发布到IIS后缺提示出现“GDI+中发生一般性错误”的异常。于是开始“摆渡”,并寻找到了解决办法:赋予 NETWORK SERVICE 帐户以写权限。以下为晚上寻找到的资料:在开发.NET应用中,使用 System.Drawing.Image.Save 方法而导致“GDI+ 中发生一般性错误”的发生,通常有以下三种原因:1. 相应的帐户没有写权限。解决方法:赋予 NETWORK SERVICE 帐户以写权限。2. 指定的物理路径不存在。解决方法:在调用 Save 方 阅读全文

posted @ 2014-01-07 12:11 软件部 阅读(347) 评论(0) 推荐(0)

C# 使用XML序列化对象(二)
摘要:在C# 使用XML序列化对象(一)中描述了使用XML序列化对象的最简单的实现。现在我们来看看稍微复杂一点的情况:现有两个类:A和B,B是A的派生类,如下所示: public class A { public int a { get; set; } } public class B : A { public int b { get; set; } }如果使用C# 使用XML序列化对象(一)中... 阅读全文

posted @ 2013-12-26 01:00 软件部 阅读(1834) 评论(0) 推荐(0)

C# 使用XML序列化对象(一)
摘要:在System.Xml.Serialization命名空间中提供了XML序列化类XmlSerializer用于将对象序列化为XML。下面看一个最简单的例子: public class A { public int a { get; set; } } public string XmlSerialize(T obj) { XmlSerializer xs = new XmlSerializer(typeof(T)); using (TextWriter ... 阅读全文

posted @ 2013-12-26 00:29 软件部 阅读(1600) 评论(0) 推荐(0)

C#的默认访问修饰符
摘要:Classes and structs that are not nested within other classes or structs can be either public or internal. A type declared as public is accessible by any other type. A type declared as internal is only accessible by types within the same assembly. Classes and structs are declared as internal by defau 阅读全文

posted @ 2013-12-20 15:01 软件部 阅读(517) 评论(0) 推荐(0)

导航