选中阴影行

方法1:单独事件独立直接写法

procedure TForm3.N10Click(Sender: TObject);
var
  I: Integer;
begin
  for I := 0 to dbgrdh1.SelectedRows.Count-1 do
  begin
    frmDataPool.qry需要做的事.GotoBookmark(pointer(dbgrdh1.SelectedRows.Items[I]));
    frmDataPool.qry需要做的事.Edit;
    frmDataPool.qry需要做的事.FieldByName(‘选中‘).AsBoolean := True;
    frmDataPool.qry需要做的事.Post;
  end;
end;

方法2:类方法

unit USelectShadow;

interface
uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Data.DB, Data.Win.ADODB,
  Vcl.ExtCtrls, Vcl.DBCtrls, Vcl.Grids, Vcl.DBGrids, Clipbrd, Vcl.Menus,
  Vcl.StdCtrls, DBGridEhGrouping, ToolCtrlsEh, DBGridEhToolCtrls, DynVarsEh,
  EhLibVCL, GridsEh, DBAxisGridsEh, DBGridEh,EhLibADO,DBGridEhImpExp;

type TSelectShadow =class
  public
  class procedure selectedshadowrecord(SAdq:TADOQuery;SDBgrdh:TDBGridEh);
end;

implementation
class procedure TSelectShadow.selectedshadowrecord(SAdq: TADOQuery; SDBgrdh: TDBGridEh);
  var
  I: Integer;
begin
  for I := 0 to SDBgrdh.SelectedRows.Count-1 do
  begin
    with SAdq do
    begin
    GotoBookmark(pointer(SDBgrdh.SelectedRows.Items[I]));
    Edit;
    FieldByName(‘选中‘).AsBoolean := True;
    Post;
    end;
  end;
end;

end.

类引用:记得在所要引用的单元uses中加上该引用类单元名(USelectShadow);

procedure TForm3.N10Click(Sender: TObject);
begin
TSelectShadow.selectedshadowrecord(frmDataPool.qry需要做的事,dbgrdh1);
end;
时间: 2024-07-30 15:02:15

选中阴影行的相关文章

取消阴影行

方法1:独立事件直接写法 procedure TForm3.N11Click(Sender: TObject); var I: Integer; begin for I := 0 to dbgrdh1.SelectedRows.Count-1 do begin frmDataPool.qry需要做的事.GotoBookmark(pointer(dbgrdh1.SelectedRows.Items[I])); frmDataPool.qry需要做的事.Edit; frmDataPool.qry需要

VBA选中多行多列及多单元格

选中多个单元格 Range("<单元格地址>:<单元格地址>[,<单元格地址>--]").Select 例:Range("A1:B2").Select   '选中"A1"."A2"."B1"."B2"四个连续的单元格 Range("12:12").Select   '选中第12行 Range("B:B").Sel

delphi CXGRID用法 (取行、列值;定位选中某行等等)

CXGRID用法 (取行.列值:定位选中某行等等) Delphi Cxgrid获取选中行列,排序规则,当前正在编辑的单元格内的值 cxGrid1DBTableView1.Controller.FocusedRowIndex 当前行号 cxGrid1DBTableView1.Controller.FocusedRow 当前行 cxGrid1DBTableView1.Controller.FocusedColumn 当前列 cxGrid1DBTableView1.Controller.Focused

dev gridcontrol选中多行数据

dev的gridcontrol控件作表格时是可以实现按Ctrl键选中多行数据的,首先改变gridcontrol的一个属性:gridview1->OptionsSelection->MultiSelect改为true,即允许选中多行.然后在需要使用的事件方法中加入以下代码:int[] rows = gridview1.GetSelectedRows();即可获取选中行的行号

CXGRID用法(取行、列值;定位选中某行等等)

Delphi Cxgrid获取选中行列,排序规则,当前正在编辑的单元格内的值 cxGrid1DBTableView1.Controller.FocusedRowIndex 当前行号 cxGrid1DBTableView1.Controller.FocusedRow 当前行cxGrid1DBTableView1.Controller.FocusedColumn 当前列cxGrid1DBTableView1.Controller.FocusedColumnIndex 当前列号cxGrid1DBTab

FineUI 选中多行获取行ID

http://www.fineui.com/bbs/forum.php?mod=viewthread&tid=2506&page=1 /// <summary>        /// 选中的行        /// </summary>        /// <param name="grid"></param>        /// <returns></returns>        prote

jQuery easyUI的datagrid,如何在翻页以后仍能记录被选中的行

1.先给出问题解决后的代码 1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%> 3 <% 4 String path = request.getContextP

设置cell选中颜色以及表格默认选中某行

1.在加载cell的地方(即 (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath里面)加上下面几句代码 [cell setBackgroundColor:CLEARCOLOR]; cell.selectedBackgroundView = [[UIView alloc] initWithFrame:cell.frame]; cell.selecte

Silverlight获取DataGrid选中的行数据

注意触发的事件为:CurrentCellChanged后台代码: /// <summary> /// 获取datagrid当前选中的单元格数据 /// 如果绑定的数据源为实体的话默认选中的当前记录为一条实体 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgca