Delphi-PRAXiS
Seite 1 von 3  1 23      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Datenbanken (https://www.delphipraxis.net/15-datenbanken/)
-   -   Delphi DisplayFormat+TStringGridanzeige (https://www.delphipraxis.net/95633-displayformat-tstringgridanzeige.html)

LOMBI 10. Jul 2007 19:28

Datenbank: ABS-db • Version: 5.12 • Zugriff über: ABSQuery

DisplayFormat+TStringGridanzeige
 
Hallo,

im AfterOpen der Query habe ich den Code:

Delphi-Quellcode:
 with DataSet.FieldByName('VKnetto') as TNumericField do
  DisplayFormat := '#.###.##0.00';
Dieser bewirkt leider nicht die gewünschte Anzeige des Betrages mit Nachkommastellen.
Wer hilft bitte?

Gruß
Lombi

marabu 10. Jul 2007 20:05

Re: DisplayFormat+TStringGridanzeige
 
Hallo Lombi,

nur der erste Punkt wird als Dezimaltrennzeichen erkannt:

Delphi-Quellcode:
with DataSet.FieldByName('VKnetto') as TNumericField do
  DisplayFormat := '#,###,##0.00';
Freundliche Grüße

LOMBI 10. Jul 2007 20:20

Re: DisplayFormat+TStringGridanzeige
 
Danke marabu,

aber im Grid steht immer noch 1 statt 1,00
Wie bitte löse ich das?

marabu 10. Jul 2007 20:22

Re: DisplayFormat+TStringGridanzeige
 
Wenn das Eingabefeld den Fokus hat, dann wird EditFormat statt DisplayFormat nicht verwendet.

Hast du den Cursor mal in ein anderes Feld gesetzt?

LOMBI 10. Jul 2007 20:26

Re: DisplayFormat+TStringGridanzeige
 
Ja, das habe ich.
Bei mir findet keine direkte Eingabe im Grid statt.
Vielleicht hängt das mit onDrawCell des Grids zusammen?

mkinzler 10. Jul 2007 20:29

Re: DisplayFormat+TStringGridanzeige
 
Zitat:

Vielleicht hängt das mit onDrawCell des Grids zusammen?
Wenn du die Zellen selber zeichnest musst du dich auch selber ums Format kümmern. was machst du im OwnerDraw?

LOMBI 10. Jul 2007 20:35

Re: DisplayFormat+TStringGridanzeige
 
In der ABSTabelle ist alles richtg dargestellt, im Grid werden die Nullen unterschlagen!
Also muß im OnDrawCell des Grid noch irgendetwas für DisplayFormat hinzugefügt werden.

mkinzler 10. Jul 2007 20:40

Re: DisplayFormat+TStringGridanzeige
 
Wie zeichnest du die Zellen?

LOMBI 10. Jul 2007 20:41

Re: DisplayFormat+TStringGridanzeige
 
Delphi-Quellcode:
...
  // Zelle einfärben
    if (ARow < FixedRows) or (ACol < FixedCols)
      then Canvas.Brush.Color := clBlue
      else
      if (ARow = Row) and (ACol >= FixedCols)
      then Canvas.Brush.Color := clYellow
      else Canvas.Brush.Color := clWhite;
      Canvas.FillRect(Rect);

mkinzler 10. Jul 2007 21:05

Re: DisplayFormat+TStringGridanzeige
 
Ruf mal die default Drawmethode auf.


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:47 Uhr.
Seite 1 von 3  1 23      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz