摘要: 先前一篇《DevExpress gridControl 布局(Layout)保存与读取----2》中,有关流的保存。我的做法是将流保存到数据库中,即将流转换为字符串,再保存。流转字符串,有两种方法:1、使用Convert.ToBase64String()对字符串进行Base64编码。2、使用System.Text.Encoding.Default.GetString()文本编码。 MemoryStream stream = new MemoryStream(); String Str=Convert.ToBase64String(stream.ToArray()); 或者String Str= 阅读全文
posted @ 2011-05-13 19:33 十一_x 阅读(1419) 评论(0) 推荐(0) 编辑
摘要: 把活动视图的布局保存到本地Xml文件中,使用SaveLayoutToXml 和 RestoreLayoutFromXml方法。using DevExpress.XtraGrid; // ...string fileName = "c:\\XtraGrid_SaveLayoutToXML.xml"; privatevoid Form1_Load(object sender, System.EventArgs e) { gridControl1.ForceInitialize(); // Restore the previously saved layout gridContr 阅读全文
posted @ 2011-05-13 18:31 十一_x 阅读(2490) 评论(0) 推荐(0) 编辑
摘要: 下面的示例代码把活动视图的布局保存到内存流中,然后从中恢复。 使用了BaseView.SaveLayoutToStream 和 BaseView.RestoreLayoutFromStream 方法。System.IO.Stream stream; // 创建并保存视图布局到内存流中str = new System.IO.MemoryStream();gridControl1.KeyboardFocusView.SaveLayoutToStream(stream);str.Seek(0, System.IO.SeekOrigin.Begin); //还原视图布局gridControl1.Key 阅读全文
posted @ 2011-05-13 17:19 十一_x 阅读(4019) 评论(0) 推荐(1) 编辑
摘要: DevExpress GridControl控件提供了自定义布局的功能,可以随意更改其布局,并保存。布局的保存有三种形式:注册表(Registry);XML文件(Xml) ;流(Stream)。 关于注册表保存,DevExpress 提供了SaveLayoutToRegistry方法来保存自定义布局到注册表中,当需要是使用RestoreLayoutFromRegistry方法读取所保存的布局并应用。 下面是的例子是将布局保存到注册表中: string regKey = "DevExpress\\XtraGrid\\Layouts\\MainLayout"; gridCont 阅读全文
posted @ 2011-05-12 21:07 十一_x 阅读(3603) 评论(0) 推荐(3) 编辑
摘要: 《C# 读取文本内容,在Dev控件中显示数据》一文是我在博客园写的第一篇随笔,多谢大家关注。现在继续,我已经自己解决了自己的两个问题,且有小小改动。这是改进后运行的效果:第一,读取第三行以后额数据并显示。简单的就是定义个计数器count,先while循环读取文本,当count为3时才开始真正的读取我们需要的内容。int count = 0; while (strLine != null) { strLine = sr.ReadLine(); count++; if (count == 3) { while (strLine != null) { string[] strArry = strLi 阅读全文
posted @ 2011-04-23 11:10 十一_x 阅读(2108) 评论(2) 推荐(1) 编辑