supergridcontrol记录,分页

谁践踏了优雅 2021-11-10 05:26 558阅读 0赞

supergridcontrol记录,分页

sqlserver分页记录

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

  

superGridControl 复制单元格文本:

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

  

显示行头序号,从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;

选中行按回车:

  1. private void superGridControl2_KeyDown(object sender, KeyEventArgs e)
  2. {
  3. if (e.KeyCode == Keys.Enter)
  4. {
  5. SelectedElementCollection col = this.superGridControl2.PrimaryGrid.GetSelectedRows();
  6. if (col.Count > 0)
  7. {
  8. e.Handled = true;
  9. GridRow row = col[0] as GridRow;
  10. var item = row.DataItem as ApplySheetListDto;
  11. var dlg = new ApplyDetailDialog(item.applyId);
  12. var pos = PointToScreen(this.gridColumn3.LocationRelative);
  13. dlg.Location = pos;
  14. dlg.ShowDialog();
  15. }
  16. }
  17. else if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control)
  18. {
  19. var pos = PointToClient(MousePosition);
  20. pos.Y -= this.superGridControl2.Parent.Location.Y;
  21. var cell = this.superGridControl2.PrimaryGrid.GetElementAt(pos.X, pos.Y);
  22. var col = this.superGridControl2.PrimaryGrid.GetColumnAt(pos);
  23. if (cell != null && col != null)
  24. {
  25. var txt = (cell as GridRow).Cells[col].Value.ToString();
  26. Clipboard.SetDataObject(txt, true);
  27. ToastNotification.Show(this.Parent, "已复制" + txt, Xiang.Business.Properties.Resources.close_16px,
  28. 2000, eToastGlowColor.Blue, eToastPosition.TopCenter);
  29. }
  30. }
  31. }

  

单个文本设置颜色:

  1. private void superGridControl1_GetCellStyle(object sender, GridGetCellStyleEventArgs e)
  2. {
  3. if (e.StyleType != StyleType.Default) { return; }
  4. var cell = e.GridCell as GridCell;
  5. if (cell == null) { return; }
  6. if (cell.Value.ToString() == "历史")
  7. {
  8. e.Style.TextColor = Color.Red;
  9. }
  10. }

  

posted on 2018-12-18 14:48 Anders’ Yan 阅读( …) 评论( …) 编辑 收藏

转载于:https://www.cnblogs.com/yansc/p/10137065.html

发表评论

表情:
评论列表 (有 0 条评论,558人围观)

还没有评论,来说两句吧...

相关阅读