supergridcontrol记录,分页

时间:2023-03-10 03:01:24
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;
}
}