cxGrid使用汇总

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cxGrid使用汇总相关的知识,希望对你有一定的参考价值。

1、自动行高:CellAutoHeight(单元自动高度)设置为True.

procedure <AForm>.<AGridColumn>PropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
var
  AColumn: TcxGridDBColumn;
  AColIndex: Integer;
begin
  AColumn := <AcxGridDBTableView>.GetColumnByFieldName(<Field Name>);
  AColIndex := AColumn.Index;
  ...
end;


procedure TForm_Sales.col_Reg_Price_UnitPropertiesEditValueChanged(
  Sender: TObject);
var Edit : TcxCustomEdit;
    c_Now,
    c_Was : currency;
    i_Rate : integer;
begin
  Edit := Sender as TcxCustomEdit;

  if (Edit <> nil) and
     (Table_Reg.FieldByName(GD_Tab_Sales_Items_Quan).AsFloat > 0) then
    begin
      c_Now := Edit.EditingValue;
      c_Was := Table_Reg.FieldByName(GD_Tab_Sales_Items_Retail_Unit).AsCurrency;
      i_Rate := 100 - trunc(100 * (c_Now / c_Was));

      if (i_Rate > Info_Clerk.Discount_Max) then
        begin
          tv_Reg.DataController.SetEditValue(col_Reg_Price_Unit.Index,
                                             Table_Reg.FieldByName(GD_Tab_Sales_Items_Price_Unit).AsCurrency,
                                             evsValue);
          ShowMessage(‘The requested discount of ‘ + IntToStr(i_rate) + ‘% exceeds the allowed maximum clerk discount of ‘ + IntToStr(Info_Clerk.Discount_Max) + ‘%.‘);
        end;
    end;
end;

 

procedure TForm1.cxDateEdit1PropertiesValidate(Sender: TObject;

  var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);

begin

  if DisplayValue = ‘TEST‘ then

  begin

    DisplayValue := ‘01/01/2004‘;

    Error := False;

  end;

end;

以上是关于cxGrid使用汇总的主要内容,如果未能解决你的问题,请参考以下文章

cxGrid使用汇总

Delphi CxGrid 汇总

CxGrid用法汇总

Delphi CxGrid 汇总

Delphi CxGrid 汇总

Delphi cxGrid表对行的操作