quarta-feira, 27 de maio de 2020

Excelente PDF com varias dicas interessantes
Delphi x Firebird

terça-feira, 26 de maio de 2020

ListView Infinito

procedure TForm2.ListView1ScrollViewChange(Sender: TObject);
var
  R: TRectF;
  LItem: TListViewItem;
  I: Integer;

begin
  if TListView(Sender).ItemCount > 0 then // Just in case...
  begin
    // Get the last item's Rect
    R := TListView(Sender).GetItemRect(TListView(Sender).ItemCount - 1);
    // Bottom?
    if R.Bottom = TListView(Sender).Height then
    begin
      Caption := 'Reached bottom!';
      for I := 21 to 40 do
      begin
        LItem := ListView1.Items.Add;
        LItem.Text := IntToStr(I);
      end;

    end
    else
      Caption := 'Bottom not reached yet.';
  end;

end;

segunda-feira, 11 de maio de 2020

Mudar cor da barra de seleção DBGrid

Essa Rotina muda a Cor da Barra de Seleção de uma DBGRID.
Aqui tb está sendo alterado a Cor da Font. (Copiado do site Planeta Delphi) 

procedure TForm1.DBGrid1DrawDataCell(Sender: TObjectconst Rect: TRect; Field: TField; State: TGridDrawState);
begin
   if gdSelected in State then    // verifica se está selecionada
      DBGrid1.Canvas.Brush.Color := clYellow;  // muda a cor
                                                                // da barra

   // Muda a Cor da Fonte
   if Table1.FieldByName('Vip_Status').AsString = 'VIP'  then
      DBGrid1.Canvas.Font.Color := clRed
   else
      DBGrid1.Canvas.Font.Color := clBlack;

      DBGrid1.DefaultDrawDataCell(Rect, Field, State);
end;

Colocar menu popup ao lado do button

var
vPonto : TPoint;
begin
   vPonto := Button1.ClientToScreen(Point(0, Button1.Height));
    PopUpMenu1.Popup(vPonto.X, vPonto.Y);