我要在一个按钮过程中使用ehib组件的按条件显示颜色的过程,代码要怎么写
需要嵌入的过程:
procedure TForm1.dbgrdh1GetCellParams(Sender: TObject; Column: TColumnEh;
  AFont: TFont; var Background: TColor; State: TGridDrawState);
  //按條件顯示行顏色
begin
 if qry1.FieldByName(BYNAME).AsString =process then
         Background :=col;
end;

解决方案 »

  1.   

    在你使用的过程中调用该过程即可
    procedure aa;
    begin  
      //如果已经声明dbgrdh1GetCellParams方法, 在此调用, 填写正确的参数即可
      dbgrdh1GetCellParams();
    end;
      

  2.   

    我试了,不成功,以按钮名为btn1为例,应该怎么写呢
      

  3.   


    unit Unit12;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm12 = class(TForm)
        btn1: TButton;
        btn2: TButton;
        procedure btn1Click(Sender: TObject);
        procedure btn2Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form12: TForm12;implementation{$R *.dfm}procedure TForm12.btn1Click(Sender: TObject);
    begin
      if Sender is TButton then
        ShowMessage(TButton(sender).Name);
    end;procedure TForm12.btn2Click(Sender: TObject);
    begin
      btn1.Click;
      {注意下边两句
       btn1Click是btn1的onClick事件, 调用时加入参数即可
      }
      btn1Click(btn1);
      btn1Click(btn2);end;end.