1. 程式人生 > >取消陰影行

取消陰影行

item ext .class pub pbr iba messages mes bad

方法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需要做的事.FieldByName(選中).AsBoolean := False;
    frmDataPool.qry需要做的事.Post;
  
end; end;

方法2:類方法

unit UUnSelectShadow;

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 TUnSelectShadow =class public class procedure unselectedshadowrecord(SAdq:TADOQuery;SDBgrdh:TDBGridEh); end; implementation class procedure TUnSelectShadow.unselectedshadowrecord(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 := False; Post; end; end; end; end.

類方法引用:記住uses中添加引用類單元名 UUnSelectShadow;

procedure TForm3.N11Click(Sender: TObject);
begin
TUnSelectShadow.unselectedshadowrecord(frmDataPool.qry需要做的事,dbgrdh1);  //取消陰影行
end;

取消陰影行