aardio调用Telerik功能组件GridView显示数据图表示例
By
admin
at 2022-03-26 • 0人收藏 • 1250人看过
import win.ui; /*DSG{{*/ var winform = win.form(text="aardio form";right=759;bottom=469) winform.add() /*}}*/ import dotNet; import System.Data; import System.Type; import System.Windows.Forms; var GridViewdll = dotNet.load("\Telerik.WinControls.GridView.dll"); //绑定窗体 var radGridViewDemo = GridViewdll.new("Telerik.WinControls.UI.RadGridView"); System.Windows.Forms.CreateEmbed(radGridViewDemo,winform); //设置属性 radGridViewDemo.Name = "radGridViewDemo"; radGridViewDemo.MasterTemplate.AutoSizeColumnsMode = 2; //创建数据和设定格式 var Data = System.Data; var integerColumn = Data.DataColumn("RowIndex",System.Type.GetType("System.Int32")); var stringColumn = Data.DataColumn("StringColumn",System.Type.GetType("System.String")); var decimalColumn = Data.DataColumn("DecimalColumn",System.Type.GetType("System.Decimal")); var boolColumn = Data.DataColumn("BooleanColumn",System.Type.GetType("System.Boolean")); //绑定数据格式 var dataTable = Data.DataTable(); dataTable.Columns.Add(integerColumn); dataTable.Columns.Add(stringColumn); dataTable.Columns.Add(decimalColumn); dataTable.Columns.Add(boolColumn); //创建随机数据 dataTable.BeginLoadData(); for(i=1;100;1){ row = dataTable.NewRow(); //第一种方式 row.Item["RowIndex"] = i; row.Item["StringColumn"] = string.random(5); row.Item["DecimalColumn"] = 3.1415 / (i + 1); row.Item["BooleanColumn"] = (math.random(1,10)%2==0)?true:false; //第二种方式 //row.ItemArray = {i, string.random(5),3.1415 / (i + 1) ,(math.random(1,10)%2==0)?true:false}; dataTable.Rows.Add(row); } dataTable.EndLoadData(); //打开功能 radGridViewDemo.EnableFiltering = true; radGridViewDemo.EnableSorting = true; radGridViewDemo.EnableGrouping = true; radGridViewDemo.MasterView.TableHeaderRow.IsVisible = true; //更新数据到图表 - 开始 radGridViewDemo.MasterTemplate.BeginUpdate(); radGridViewDemo.DataSource = dataTable; //格式化特定列 radGridViewDemo.MasterTemplate.Columns.Item["DecimalColumn"].FormatString = "{0:F6}"; radGridViewDemo.MasterTemplate.EndUpdate(); winform.show(); win.loopMessage();
这个我下载的是Telerik2022试用版, 估计打包发上来你们也不一定能运行....
经过换电脑测试 , 发现aardio调用这个dll 并不会有试用提示, 而且貌似也无限制,
相比我用vs开发的程序, 无论是源码运行还是exe直接运行,都有下面图片中试用提示, 哈哈
链接:https://pan.baidu.com/s/1ymr8kc0pooJ5HAkGxw-v0Q
提取码:ttmn
7 个回复 | 最后更新于 2022-04-03
![the100s](/upload/avatar/middle/203.png)
the100s
2022-03-27
#1
跟上admin脚步
加个Telerik UI for winforms的链接
https://docs.telerik.com/devtools/winforms/controls/gridview/overview
登录后方可回帖