⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 baseaccountvoucher.pas

📁 中小企业管理系统------ ERP系统原代码
💻 PAS
📖 第 1 页 / 共 2 页
字号:
end;

function TfrmBaseAccountVoucher.ShowCurrecyEdit(ARect: TRect): boolean;
begin
  CurrencyEdit.Left := ARect.Left;
  CurrencyEdit.Top := ARect.Top;
  CurrencyEdit.Width := ARect.Right - ARect.Left;
  CurrencyEdit.Height := ARect.Bottom - ARect.Top;
  CurrencyEdit.Color := CurrencyEdit.FocusedColor;
  if (CurrencyEdit.Tag = 1) and not CurrencyEdit.Visible then
  begin
    CurrencyEdit.Visible := True;
  end;
  Result := True;
end;

function TfrmBaseAccountVoucher.DrawCurrencyEdit(ACanvas: TCanvas; ARect: TRect;
  AText: string): Boolean;
var
  OldColor, OldFontColor: TColor;
begin
  OldColor := CurrencyEdit.Color;
  OldFontColor := CurrencyEdit.Font.Color;
  CurrencyEdit.Color := gridMain.Color;
  if AText = '' then
    AText := '0';
  CurrencyEdit.Font.Color := gridMain.Font.Color;
  DrawCurrencyFrame(ACanvas, ARect, CurrencyEdit, StrToFloat(AText));
  CurrencyEdit.Color := OldColor;
  CurrencyEdit.Font.Color := OldFontColor;
  Result := True;
end;

procedure TfrmBaseAccountVoucher.gridMainChangeColumn(Sender: TObject;
  Node: TdxTreeListNode; Column: Integer);
begin
  inherited;
  if CheckCurrencyField(gridMain.FocusedField.FieldName) then
  begin
    CurrencyEdit.Tag := 1;
    ChangeCells;
  end
  else
  begin
    CurrencyEdit.Visible := false;
    CurrencyEdit.Tag := 0;
  end;
end;

procedure TfrmBaseAccountVoucher.CurrencyEditMoveOut(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  inherited;
  case Key of
    VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT:
      begin
        gridMain.SetFocus;
        SendMessage(gridMain.Handle, WM_KEYDOWN, WORD(Key), 0);
      end;
  end;
end;

function TfrmBaseAccountVoucher.ChangeCells: Boolean;
begin
  with gridMain do
  begin
    if CheckCurrencyField(Columns[FocusedColumn].FieldName) then
    begin
      CurrencyEdit.Left := 2000;
      CurrencyEdit.Visible := True;
      CurrencyEdit.DataField := Columns[FocusedColumn].FieldName;
      if CurrencyEdit.Visible then
        CurrencyEdit.SetFocus;
    end;
  end;
  Result := True;
end;

procedure TfrmBaseAccountVoucher.gridMainCustomDrawBand(Sender: TObject;
  ABand: TdxTreeListBand; ACanvas: TCanvas; ARect: TRect;
  var AText: string; var AColor: TColor; AFont: TFont;
  var AAlignment: TAlignment; var ADone: Boolean);
begin
  inherited;
  if (ABand.Index = 0) or (ABand.Index = 1) then
    ADone := SetBandCenter(gridMain, ABand, ACanvas, ARect, AText);
end;

procedure TfrmBaseAccountVoucher.bbInsClick(Sender: TObject);
begin
  inherited;
  gridMain.DataLink.DataSet.Append;
end;

procedure TfrmBaseAccountVoucher.bbDelRowClick(Sender: TObject);
begin
  inherited;
  gridMain.DataLink.DataSet.Delete;
end;

procedure TfrmBaseAccountVoucher.dxBarLargeButton7Click(Sender: TObject);
begin
  inherited;
  WinExecCalc;
end;

procedure TfrmBaseAccountVoucher.gridMainChangedColumnsWidth(
  Sender: TObject);
begin
  inherited;
  SetCurrecyLable;
end;

procedure TfrmBaseAccountVoucher.CurrencyEditKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  inherited;
  case KEY of
    VK_RETURN:
      begin
        gridMain.SetFocus;
        SendMessage(gridMain.Handle, WM_KEYDOWN, Key, 0);
      end;
    VK_ESCAPE: gridMain.SetFocus;
  end;
end;

procedure TfrmBaseAccountVoucher.gridMainKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  inherited;
  case KEY of
    VK_RETURN:
      with gridMain do
        if FocusedColumn = 2 then
          FocusedColumn := FocusedColumn + 1
        else
          if FocusedColumn = 3 then
          begin
            FocusedColumn := 0;
            if isEof then
              DataLink.DataSet.Append
            else
              DataLink.DataSet.Next;
            gridMain.ShowEditor;
          end;
  end;
end;

procedure TfrmBaseAccountVoucher.FormKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  inherited;
  case KEY of
    VK_RETURN:
      begin
        if GetFocusedComponent(self) is TdxInplaceEdit then
          perform(WM_NEXTDLGCTL, 0, 0);
      end;
    VK_ESCAPE: Close;
  end;
end;

procedure TfrmBaseAccountVoucher.FormShow(Sender: TObject);
begin
  inherited;
  SetCurrecyLable;
end;

procedure TfrmBaseAccountVoucher.gridMainKeyPress(Sender: TObject;
  var Key: Char);
begin
  inherited;
  if (key <> chr(9)) and
    CheckCurrencyField(gridMain.Columns[gridMain.FocusedColumn].FieldName) then
  begin
    CurrencyEdit.SetFocus;
    SendMessage(CurrencyEdit.Handle, WM_Char, WORD(Key), 0);
  end;
end;

procedure TfrmBaseAccountVoucher.GridDrawSummaryFooter(Sender: TObject; ACanvas:
  TCanvas; ARect: TRect;
  var AText: string; var AAlignment: TAlignment; AFont: TFont; var AColor:
  TColor;
  var ADone: Boolean);
begin
  inherited;
  if not (edgoLoadAllRecords in
    TdxDBGrid(TdxDBTreeListColumn(Sender).ATreeList).OptionsDB) then
    AText := CalcColumnSummary(TdxDBTreeListColumn(Sender));
end;

procedure TfrmBaseAccountVoucher.ADOSetListRecordChangeComplete(
  DataSet: TCustomADODataSet; const Reason: TEventReason;
  const RecordCount: Integer; const Error: Error;
  var EventStatus: TEventStatus);
begin
  inherited;
  ChangeCells;
end;

procedure TfrmBaseAccountVoucher.edtDateKeyDown(Sender: TObject;
  var Key: Word; Shift: TShiftState);
begin
  inherited;
  case KEY of
    VK_DOWN: SendMsg(TWinControl(Sender).Handle, WM_KEYDOWN, VK_F4);
  end;
end;

procedure TfrmBaseAccountVoucher.FormCreate(Sender: TObject);
begin
  inherited;
  bDrawFullGrid := StrToBool2(GetIniValue(frmData.ADOConnetLogin, 'DrawFullGrid'));
end;

procedure TfrmBaseAccountVoucher.gridMainMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  P: TPoint;
begin
  inherited;
  GetCursorPos(P);
  if Button = mbRight then
    GridPopMenu.Popup(P.X, P.Y)
  else
    if (Button = mbLeft) and (gridMain.GetHitTestInfoAt(X, Y) = htNowhere) then
      bbIns.Click;
end;

procedure TfrmBaseAccountVoucher.gridMainCustomDraw(Sender: TObject;
  ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
  AColumn: TdxDBTreeListColumn; const AText: string; AFont: TFont;
  var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
begin
  inherited;
  if bDrawFullGrid then DrawFullGrid(gridMain, ACanvas, ARect, ANode);
end;

end.



//此源码由程序太平洋收集整理发布,任何人都可自由转载,但需保留本站信息
//╭⌒╮┅~ ¤ 欢迎光临程序太平洋╭⌒╮
//╭⌒╭⌒╮╭⌒╮~╭⌒╮  ︶  ,︶︶
//,︶︶︶︶,''︶~~ ,''~︶︶  ,''
//╔ ╱◥███◣═╬╬╬╬╬╬╬╬╬╗
//╬ ︱田︱田 田 ︱          ╬
//╬       http://www.5ivb.net ╬
//╬  ╭○╮●                     ╬
//╬  /■\/■\                    ╬
//╬   <| ||    有希望,就有成功! ╬
//╬                 ╬
//╚╬╬╬╬╬╬╬╬╬╬╗  ╔╬╬╬╬╝
//
//说明:
//专业提供VB、.NET、Delphi、ASP、PB源码下载
//包括:程序源码,控件,商业源码,系统方案,开发工具,书籍教程,技术文档

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -