关于 SourceGrid 学习编写 记录

一、插件添加方法

1. 添加工程引用

引用->右键添加引用->浏览->选择准备好的System.Windows.Forms.Ribbon.dll文件

2. 工具箱内添加控件

工具箱右键选择项->.NEF Framework组件->浏览->选择准备好的SourceGrid.dll文件

二、相关用法备份

1.设置表大小:  Grid_Minerals.Redim(行数, 列数);

2.表头相关:

    创建:SourceGrid.Cells.ColumnHeader head1 =new SourceGrid.Cells.ColumnHeader("表头名称");

               Grid_Minerals[0, 0] = head1;

               head1.AutomaticSortEnabled = false;

    表头字体,对齐方式:

            SourceGrid.Cells.Views.ColumnHeader boldHeader = new SourceGrid.Cells.Views.ColumnHeader();
            boldHeader.Font = new Font("Microsoft YaHei UI", 11, FontStyle.Bold);
            boldHeader.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
            Grid_Minerals[0, 0].View = boldHeader;

3.总体编辑:

    Grid_Minerals.Rows.SetHeight(行数, 高度);

    Grid_Minerals.Columns.SetWidth(列数, 宽度);   

    Grid_Minerals.Selection.EnableMultiSelection = false; 不可同时选中多个

    Grid_Minerals.AutoStretchColumnsToFitWidth = true;  自适应宽度
    Grid_Minerals.Columns[0].Width = 20;                          某一列宽度

    Grid_Minerals.FixedRows = n;// 第n个行不可以滚动(表头不参与滚动)

    Grid_Attributes[0, 0].ColumnSpan = 2; //从[0,0]开始合并2个单元格

    Grid_Attributes.AutomaticSortEnabled = false;   //不可自动排序

    Grid_Attributes.Refresh();  //表刷新

    启动时默认无选中:Grid_Attributes.Selection.FocusStyle = SourceGrid.FocusStyle.None;

    创建单元格:   Grid_Attributes[1, 0] = new SourceGrid.Cells.Cell("名称", typeof(数据类型));

    设置单元格相关参数:

            SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
            view.Font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
            view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
            view.BackColor = Color.LightGray;
            Grid_Attributes[0, 0].View = view;

    单元格添加事件:

           SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
           clickEvent.Click += new EventHandler(clickEvent_Click);
           Grid_Attributes[2,1].AddController(clickEvent);

            SourceGrid.Cells.Controllers.CustomEvents ValueChangedEvent = new SourceGrid.Cells.Controllers.CustomEvents();
            ValueChangedEvent.ValueChanged += new EventHandler(Event_ValueChanged);
            Grid_FroupId[i, 0].AddController(ValueChangedEvent);

   单元格焦点显示(但不是处于选中状态)

            SourceGrid.Position po = new SourceGrid.Position(1, 0);
            Grid_Attributes.Selection.Focus(po, true);

    单元格焦点显示(并且处于选中状态)

            SourceGrid.Position po = new SourceGrid.Position(1, 0);
            Grid_Attributes[1, 0].Grid.Select();
            Grid_Attributes.Selection.Focus(po, true);

   单元格不可选中:Grid_Attributes[0, 1].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);

   添加Combobox类型单元格:

           List<string> ss = new List<string>();
           foreach (DataRow item in dt.Rows)
            {
               填充表ss;
             }
           SourceGrid.Cells.Editors.ComboBox GroupIdCBBox = new SourceGrid.Cells.Editors.ComboBox(typeof(string));
           GroupIdCBBox.StandardValues = ss;
           GroupIdCBBox.EditableMode = SourceGrid.EditableMode.SingleClick| SourceGrid.EditableMode.Focus;//点击显示下拉列表
           m_Attributes.Grid_Attributes[9, 1] = new SourceGrid.Cells.Cell("显示的内容", GroupIdCBBox);

           m_ComboboxText.Control.DropDownStyle = ComboBoxStyle.DropDownList;        //设置下拉框为不可以编辑的状态

相关资料引用(感谢相关大神):

          1.https://blog.csdn.net/vainnetwork/article/details/1858229?ops_request_misc=&request_id=&biz_id=102&utm_term=SourceGrid%20%E9%A2%9C%E8%89%B2&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-2-1858229

          2.https://www.cnblogs.com/zhoushuang0426/p/10868268.html

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值