首页 > 代码库 > 选中阴影行
选中阴影行
方法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;
选中阴影行
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。