supergridcontrol记录,分页

Posted yansc

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了supergridcontrol记录,分页相关的知识,希望对你有一定的参考价值。

sqlserver分页记录

select top 50 DengJiBH,sSuoYouQuanShenQingRen,sZuoLuo,sQiuHao,sQuanHao,ChaXun_BianHao,rownumber,zZhuCeLXBH,sMianJi,gDengJiLXBH
from(
select row_number() over(order by isnull(Zi.DengJiBH,‘00000000‘)) as rownumber, 
dj_DengJi.DengJiBH,dj_DengJi.sSuoYouQuanShenQingRen,Zi.sZuoLuo,Zi.sQiuHao,
Zi.sQuanHao,isnull(Zi.DengJiBH,‘00000000‘) as ChaXun_BianHao,Zi.zZhuCeLXBH,Zi.sSuoYouQuanZH,zi.sMianJi,zi.gDengJiLXBH
from dj_DengJi 
left join dj_DengJi Zi on dj_DengJi.DengJiBH=Zi.zPiDengJiBH 
where dj_DengJi.gQuanLi=4 and dj_DengJi.gWanCheng<>1 
and dj_DengJi.sSuoYouQuanShenQingRen like ‘%鑫苑万卓%‘ 
and Zi.sZuoLuo like ‘%高铁新城%‘
--and dj_DengJi.DengJiBH=‘151004824 ‘
) b
where rownumber>(50*(1-1)) order by rownumber

  

superGridControl 复制单元格文本:

        private void superGridControl2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control)
            {
                var pos = PointToClient(MousePosition);
                pos.Y -= this.superGridControl2.Parent.Location.Y;
                var cell = this.superGridControl2.PrimaryGrid.GetElementAt(pos.X, pos.Y);
                var col = this.superGridControl2.PrimaryGrid.GetColumnAt(pos);
                if (cell != null && col != null)
                {
                    var txt = (cell as GridRow).Cells[col].Value.ToString();
                    Clipboard.SetDataObject(txt, true);
                    ToastNotification.Show(this.Parent, "已复制" + txt, Xiang.Business.Properties.Resources.close_16px,
                       2000, eToastGlowColor.Blue, eToastPosition.TopCenter);
                }
            }
        }

  

显示行头序号,从1开始

this.superGridControl2.PrimaryGrid.ShowRowGridIndex = true;
this.superGridControl2.PrimaryGrid.RowHeaderIndexOffset = 1;

选中行对象:

GridRow row = this.superGridControl2.PrimaryGrid.GetSelectedRows().FirstOrDefault() as GridRow;
var arc = row.DataItem as ArchivementDto;

 

选中行按回车:

        private void superGridControl2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                SelectedElementCollection col = this.superGridControl2.PrimaryGrid.GetSelectedRows();
                if (col.Count > 0)
                {
                    e.Handled = true;
                    GridRow row = col[0] as GridRow;
                    var item = row.DataItem as ApplySheetListDto;

                    var dlg = new ApplyDetailDialog(item.applyId);
                    var pos = PointToScreen(this.gridColumn3.LocationRelative);
                    dlg.Location = pos;
                    dlg.ShowDialog();
                }
            }
            else if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control)
            {
                var pos = PointToClient(MousePosition);
                pos.Y -= this.superGridControl2.Parent.Location.Y;
                var cell = this.superGridControl2.PrimaryGrid.GetElementAt(pos.X, pos.Y);
                var col = this.superGridControl2.PrimaryGrid.GetColumnAt(pos);
                if (cell != null && col != null)
                {
                    var txt = (cell as GridRow).Cells[col].Value.ToString();
                    Clipboard.SetDataObject(txt, true);
                    ToastNotification.Show(this.Parent, "已复制" + txt, Xiang.Business.Properties.Resources.close_16px,
                       2000, eToastGlowColor.Blue, eToastPosition.TopCenter);
                }
            }
        }

  

单个文本设置颜色:

        private void superGridControl1_GetCellStyle(object sender, GridGetCellStyleEventArgs e)
        {
            if (e.StyleType != StyleType.Default) { return; }

            var cell = e.GridCell as GridCell;
            if (cell == null) { return; }

            if (cell.Value.ToString() == "历史")
            {
                e.Style.TextColor = Color.Red;
            }
        }

  

以上是关于supergridcontrol记录,分页的主要内容,如果未能解决你的问题,请参考以下文章

SuperGridControl 使用小技巧

DotNetBar使用技巧之SuperGridControl鼠标左键滑动选中

DJANGO 自定义分页组件

modx - 当我在同上片段中使用“&documents =”参数时,分页不起作用

片段被视图分页器布局切割

Symfony2 将哈希片段参数附加到分页 URL