Autor Beitrag
berni
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mi 19.03.03 14:58 
Hallo,

gibt es die Möglichkeit in einer Edit Box oder einem
Feld eines String Grids den Text rechtsbündig auszurichten ?

Oder gibt es alternative Komponenten anstelle
Edit oder StringGrid, die das können ?

Gruss,
Bernd
delphiDeveloper
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48



BeitragVerfasst: Mi 19.03.03 15:10 
Titel: Alternative zu TStringGrid
Schau mal bei Andreas Hörstemeier vorbei:

www.hoerstemeier.com/

Dort gibt es ein StringAlignGrid in dem man jede Zelle/Spalte
einfach formatieren kann.
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mi 19.03.03 15:18 
Hallo,

folgend eine Edit-Komponente, die um den Stil Alignment erweitert wurde:
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:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
unit AlignmentEdit;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, 
  Dialogs, StdCtrls;

type
  TAlignmentEdit = class(TEdit)
  private
    fAlignment:TAlignment;
  protected
    procedure CreateParams(var Params:TCreateParams); override;
  published
    property Alignment:TAlignment read fAlignment write SetAlignment;
  end; // TAlignmentEdit


procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Beispiele', [TAlignmentEdit]);
end;


// ----- TAlignmentEdit
procedure TAlignmentEdit.CreateParams(var Params: TCreateParams);
const Alignments:array[TAlignment] of DWord=(ES_Left, ES_Right, ES_Center);
begin
  inherited CreateParams(Params);
  Params.Style:=Params.Style or ES_MultiLine Or Alignments[fAlignment];
end; // TAlignmentEdit.CreateParams


procedure TAlignmentEdit.SetAlignment(aValue:TAlignment);
begin
  if (fAlignment<>aValue) then
  begin
    fAlignment:=aValue;
    RecreateWnd;
  end; // if
end; // TAlignmentEdit.SetAlignment

end.

Bei einem StringGrid musst Du die rechtsbündige-Ausgabe selber zeichnen. Als Stichwort OnDrawCell.

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
wunsiedler
ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 506
Erhaltene Danke: 4

Win7

BeitragVerfasst: Di 16.09.03 12:32 
Das mit dem StringGrid hätt ich auch gern gewusst, aber ein Stichwort sagt mir gar nix! Sind nicht nur Profis hier , sonder auch Anfänger wie ich.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Di 16.09.03 14:39 
Dann sag uns bitte wo genau du Probleme hast. Dann können wir dir helfen!

Gruß
Tino
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 16.09.03 17:05 
Über Textausrichtung im Stringgrid hatte ich schon mal was geschrieben. Mußt du mal suchen.
wunsiedler
ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 506
Erhaltene Danke: 4

Win7

BeitragVerfasst: Di 16.09.03 18:01 
Machen wir hier weiter:

www.delphi-forum.de/...ic.php?p=95659#95659

Das Thema entspricht mehr meinem Problem.