相关类介绍:


1.LSGOUIGridEntity 用于配置FlexCell表格各种参数的实体

有已下三种便捷的方法,均返回已经配置好参数的LSGOUIGridEntity 类的实体

GetNormalGridEntity()          得到普通类型的MisUIGridEntity.

GetDark_LightBlueGridEntity()  得到深蓝-浅蓝格调的GridEntity.

GetYellow_WhiteGridEntity()    得到黄-白格调的GridEntity.

示例:LSGOUIGridEntity gridEntity = (new LSGOUIGridEntity()).GetYellow_WhiteGridEntity();

2.LSGOUIGrid FlexCell表格控件类,提供初始化,操纵表格的各种静态方法

Init:初始化FlexCell表格控件的属性及样式

public static void Init(Grid Grid, LSGOUIGridEntity GridEntity)

示例:LSGOUIGrid.Init(grid, gridEntity);

InitHeader 初始化表格的列名(通过字符串链表/ILSGODataFieldCollection)

public static void InitHeader(Grid Grid, List<string> FieldList)

public static void InitHeader(Grid Grid, ILSGODataFieldCollection FieldCollection)

示例:

List<string> pListStr = new List<string> { "版本属性", "版本信息" };   //创建字符串链表

LSGOUIGrid.InitHeader(grid, pListStr);   //初始化表格的列名

将信息填入FlexCell表格中 

FillDataToGrid()的各种重载方法

public static void InsertDataToGrid(List<string> valueList, Grid Grid) //自定义方法

示例:LSGOUIGrid.InsertDataToGrid(new List<string> { "用户名", "" }, grid_Verson);

使用方法示例:

整体思路分三或四步:

实例化 LSGOUIGridEntity

调用LSGOUIGrid.Init()初始化表格

(选)调用LSGOUIGrid.InitHeader()初始化列名

填充内容FillDataToGrid()/InsertDataToGrid()

注:示例1使用LSGOUIGrid.InitHeader()初始化列名,使用InsertDataToGrid()自定义插入数据。

示例2使用FillDataToGrid()方法,通过LSGODataFieldCollection,和LSGODataRowCollection来填充表格内容。初始化列名工作由FillDataToGrid()方法完成


示例1:

/// <summary>

/// 初始化版本信息表格

/// </summary>

/// <param name="grid"></param>

private void InitGrid_Verson(Grid grid)

{

LSGOUIGridEntity gridEntity = (new LSGOUIGridEntity()).GetYellow_WhiteGridEntity();

LSGOUIGrid.Init(grid, gridEntity);

grid.ExtendLastCol = true;  //自动延长最后一列

List<string> pListStr = new List<string> { "版本属性", "版本信息" };

LSGOUIGrid.InitHeader(grid, pListStr);

LSGOUIGrid.InsertDataToGrid(new List<string> { "用户名", "" }, grid_Verson);

LSGOUIGrid.InsertDataToGrid(new List<string> { "版本名", "" }, grid_Verson);

LSGOUIGrid.InsertDataToGrid(new List<string> { "父版本名", "" }, grid_Verson);

LSGOUIGrid.InsertDataToGrid(new List<string> { "创建时间", "" }, grid_Verson);

LSGOUIGrid.InsertDataToGrid(new List<string> { "最后修改时间", "" }, grid_Verson);

LSGOUIGrid.InsertDataToGrid(new List<string> { "版本描述", "" }, grid_Verson);

grid.Column(0).AutoFit();

}


示例2:

在学生信息管理系统中,查询学生表中,学号为“Sno”的学生的信息


//初始化

LSGOUIGridEntity gridEntity = (new LSGOUIGridEntity()).GetYellow_WhiteGridEntity();

LSGOUIGrid.Init(grid1, gridEntity);

//读取数据

ILSGOSearchFilter pQueryFilter = new LSGOSearchFilter();

pQueryFilter.WhereClause = " Sno= '" + Sno + "'";

rowCollection = new LSGOMisDbComFun(MisDBType.MainDB).GetRowCollectionFromMain(

LSGOMisSystemProperty.ProPrefix + "Student", pQueryFilter);

ILSGODataTable table =

(new LSGOMisDbComFun(MisDBType.MainDB)).GetTableFromMain(LSGOMisSystemProperty.ProPrefix + "Student");

//填充数据

LSGOUIGrid.FillDataToGrid("错误", table.FieldCollection, rowCollection, grid1);

//输出为Excel表格和HTML文档

LSGOUIGrid.ExportToHTML("D:\\学生信息管理系统\\StudentManagementSystem\\bin\\Debug\\aaa.html", grid1);

LSGOUIGrid.ExportToExcel("D:\\学生信息管理系统\\StudentManagementSystem\\bin\\Debug\\aaa.xls", true,true, grid1);

示例2运行结果:


示例3:

列标题会默认命名为数据库中的字段名,若不满意,可调用InitHeader()自定义列标题

string sql =

"select StudentCourse.Cno,Cname,Cpno,Ccredit,Cteacher from Course,StudentCourse where StudentCourse.Cno=Course.Cno and Sno='" + Sno + "'";

DataSet dataset = new LSGOMisDbComFun(MisDBType.MainDB).GetDataSetFromMain(sql);

LSGOUIGrid.FillDataToGrid("数据导入失败", dataset, 0, grid_HasSelectCourse);

//重命名列表题

List<string> pListStr = new List<string> { "课程号", "课程名", "先修课", "学分", "任课教师" };

LSGOUIGrid.InitHeader(grid_HasSelectCourse, pListStr);


常用属性

AutoRedraw  自动重绘

ExtendLastCol 自动延长最后一列

Rows、Cols 行数,列数。

可用于清空功能:如grid.Rows = 1;可将表格列标题以外的行清空

Locked  只读

特别的,如果需要对表格中的某些元素/行/列设置只读,其余不设,偷懒的方法是不行的。需要对表格整体设置非只读,然后对只读元素依次设置,例如:

//取消教师评价列的只读设置

grid_StudentScore.Locked = false;

grid_StudentScore.Column(0).Locked = true ;

grid_StudentScore.Column(1).Locked = true;

grid_StudentScore.Column(2).Locked = true;

grid_StudentScore.Column(3).Locked = true;

grid_StudentScore.Column(4).Locked = true;

转载于:https://blog.51cto.com/9565698/1575163

LSGO类库使用方法备忘——FlexCell相关推荐

  1. [译] Kotlin 标准方法备忘

    原文地址:Kotlin Standard Functions cheat-sheet 原文作者:Jose Alcérreca 译文出自:掘金翻译计划 本文永久链接:github.com/xitu/go ...

  2. AR9331出现connect-debounce failed,port 1 disabled解决方法备忘

    基于AR9331的路由器,自己画的pcb板子,竟然出现这个错误,百度下,貌似有不少人遇见过这个错误,但是在修改板子前我的固件用的是没问题的,USB完美使用 修改过板子后出现这个问题! hub 1-0: ...

  3. 0xc000007b错误 - 解决方法备忘(vc red重装)

    关于这个,大部分网络文章一般将该错误定性为directx错误,加上此时重新安装directx会遇到"内部系统错误",更加增加了迷惑性.近期安装MAYA2013后遇到了这种情况,我以 ...

  4. 阅读一款3D引擎的方法备忘

    要带着引擎系统所共有的问题去阅读,不要被具体引擎的实现思路牵着走,要思考这个引擎如何实现或绕过(如不考虑低端机)这些必然要面临的问题. 首先,最重要的必须,在Debug模式下调试起来一个主场景程序,然 ...

  5. windows中 修改某种文件图标 的方法 (备忘)

    某些文件类型在windows没有特别的图标显示, 特别是对于工程师来说,在一个project文件夹下, 经常会有一堆相同文件名不同扩展名的文件, 当你要找其中一个时, 瞪大眼睛瞅半天. 比如我想在一个 ...

  6. jquery中的ajax方法(备忘)

    参考:https://www.cnblogs.com/tylerdonet/p/3520862.html w3school:http://www.w3school.com.cn/jquery/ajax ...

  7. JAVA中获得一个月最大天数的方法(备忘)

    Calendar 类是一个抽象类,为日历字段之间的转换提供了一些方法. 其中有一个重要方法 getActualMaximum ,该方法用于返回指定日历字段实际的最大值. 利用这个方法(Calendar ...

  8. eclipse插件安装方法备忘

    eclipse是java开发者的开发利器,eclipse的开发插件也是类目众多,玲琅满目.安装eclipse插件的方式不外乎两种:1.使用eclipse提供的在线更新功能,使用插件发布地址,下载并安装 ...

  9. android 禁止app横屏(坚屏)方法(备忘)

    修改androidmanifest.xml文件,在相应的activity里增加: android:screenOrientation="portrait"(这是锁定坚屏) port ...

最新文章

  1. vue中axios如何实现token验证
  2. JAVA设计模式-策略模式
  3. .NET精品文章系列(二)
  4. Wannafly挑战赛17 - 求值2 (逆元 + 杨辉三角公式)
  5. 高可用集群技术之corosync应用详解(一)
  6. 22岁少年破解史上最严重网络攻击,拯救全球互联网,三个月后却被FBI逮捕
  7. eclise去连接mysql,Eclipse如何连接MySQL
  8. MyBaits resultMap 返回值与对象不匹配处理
  9. nginx ---- Nginx服务器基础配置实例
  10. how to open files as sudo
  11. Winrunner经验总结
  12. 25.构造ICMP数据包
  13. 码织匠C语言程序设计,“C语言程序设计”课程的教学资源融合建设研究
  14. OpenCASCADE:Qt OCCT 概览示例
  15. ffmpeg将多个MP4合并成一个MP4
  16. Python如何查询版本号
  17. AVFoundation开发秘籍笔记-03资源和元数据
  18. 16、基于51单片机智能浇花自动浇水灌溉土壤湿度检测报警系统设计
  19. 表关联之内关联用法案例详解
  20. 微信公众平台流量主单日广告收入最高达5万元 羡煞偶们

热门文章

  1. 大数据时代的廉政制度创新
  2. 财管理系统 财务 家庭理财 收支 报表 SSM
  3. AS3933 寄存器配置
  4. Beyond Compared4 破解
  5. Ae 效果详解:毛边
  6. 了解云平台;云计算;云服务
  7. Windows10-1803版本设置自定义切换输入法的快捷键
  8. UE风格化Day3-maya建模中的对称问题
  9. 《精神论》物质与精神的辩证关系及产品范畴的有关阐述
  10. RIP(第二天笔记)