Autor Beitrag
D. Annies
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: So 11.11.07 18:03 
Hi, Delpher,

(wie) kann man verschieden hohe Geldbeträge rechtsbündig formatieren, so dass die Kommas untereinander stehen? Eine Proportionalschrift wollte ich nicht verwenden.

Danke für Hilfe,
Detlef
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: So 11.11.07 18:06 
Stichwort Suche in: Delphi-Forum, Delphi-Library OWNERDRAW.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: So 11.11.07 19:05 
Hi, Jakob,

leider ist mir deine Antwort noch zu allgemein - ich blicke nicht durch.
Kannst du etwas konkreter werden?

Gruß, Detlef
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 11.11.07 19:37 
Jo, Herr Lehrer,
das Ereignis OnDrawCell ruft die Procedure SG1DrawCell auf.
SG1 heisst mein Stringgrid.

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
procedure StringGridAlignment(Grid: TStringGrid; Rect: TRect; ACol, ARow: Integer;
  Alignment: TAlignment; LineBreak: Boolean);
var
  TextOut: String;
begin
  Grid.Canvas.FillRect(Rect);
  TextOut := Grid.Cells[ACol,ARow];
  if LineBreak = false then
  begin
    if Alignment = taLeftJustify then
      DrawText(Grid.Canvas.Handle, PChar(TextOut), StrLen(PChar(TextOut)), Rect,DT_LEFT);
    if Alignment = taCenter then
      DrawText(Grid.Canvas.Handle, PChar(TextOut), StrLen(PChar(TextOut)), Rect,DT_CENTER);
    if Alignment = taRightJustify then
      DrawText(Grid.Canvas.Handle, PChar(TextOut), StrLen(PChar(TextOut)), Rect,DT_RIGHT);
  end
  else
  begin
    if Alignment = taLeftJustify then
      DrawText(Grid.Canvas.Handle, PChar(TextOut), StrLen(PChar(TextOut)),
      Rect,DT_LEFT+DT_WORDBREAK);
    if Alignment = taCenter then
      DrawText(Grid.Canvas.Handle, PChar(TextOut), StrLen(PChar(TextOut)), Rect,
      DT_CENTER+DT_WORDBREAK);
    if Alignment = taRightJustify then
      DrawText(Grid.Canvas.Handle, PChar(TextOut), StrLen(PChar(TextOut)), Rect,
      DT_RIGHT+DT_WORDBREAK);
  end;
end;

procedure TForm1.SG1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect;
  State: TGridDrawState);
begin StringGridAlignment(SG1, Rect, ACol, ARow, taRightJustify, True); end;
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: So 11.11.07 20:07 
Hi, Hathor,
ich habe erstmal herzlich gelacht über deine Ansprache: Jo, Herr ...

Deine Antwort läßt wohl keine Wünsche übrig - herzlichen Dank dafür, umbasteln ist natürlich klar.

Ich denke mal, das ist gelöst :idea: :zustimm:

Bis denne, dein ...