Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Prism kleines D8 Programm (https://www.delphipraxis.net/27270-kleines-d8-programm.html)

Hansa 6. Aug 2004 21:33


kleines D8 Programm
 
Hi,

wer D8 hat soll/kann sich das hier mal ansehen :

Delphi-Quellcode:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.nfm}

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
procedure TfrmRegis.sgRegisDrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);

procedure WriteText(StringGrid: TStringGrid; ACanvas: TCanvas; const ARect: TRect;
    const Text: string);
  const
    DY = 2;
  var
    S: array[0..255] of Char;
  begin
    with Stringgrid, ACanvas, ARect do begin
      ExtTextOut(Handle, Right - TextWidth(Text) - 3, Top + DY,
            ETO_OPAQUE or ETO_CLIPPED, @ARect, StrPCopy(S, Text),
            Length(Text), nil);
    end;
  end;

  procedure Display(StringGrid: TStringGrid; const S: string);
  begin
    WriteText(StringGrid, StringGrid.Canvas, Rect, S);
  end;

begin
  inherited;
  if (ACol in [1,4,6,7]) then
    Display(sgRegis, sgRegis.Cells[ACol, ARow]);
end;

end.
Das ist ein Teil eines D7 Programmes. Und zwar ein Stringgrid auf einer Form, sonst nichts. Das einzige was erreicht werden soll : manche Zellen sollen wegen Zahlen rechtsbündig dargestellt werden. Compilieren tut es nicht. Das @ stört wohl auch und ich will gerne nach und nach solchen Sachen auf die Spur kommen. Wer da Lust hat, kann es mal versuchen zu compilieren und seinen Kommentar über neue Erkenntnisse hier abgeben.

[EDIT]Tipfvela vrbressert

sakura 6. Aug 2004 21:57

Re: kleines D8 Programm
 
Works for me (in D8):
Delphi-Quellcode:
procedure TForm1.sgRegisDrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);

  procedure WriteText(StringGrid: TStringGrid; ACanvas: TCanvas; const ARect: TRect; const Text: string);
  const
    DY = 2;
  var
    S: array[0..255] of Char;
  begin
    with Stringgrid, ACanvas, ARect do begin
      ExtTextOut(Handle, Right - TextWidth(Text) - 3, Top + DY,
            0, ARect, Text, Length(Text), nil);
    end;
  end;

  procedure Display(StringGrid: TStringGrid; const S: string);
  begin
    WriteText(StringGrid, StringGrid.Canvas, Rect, S);
  end;

begin
  if (ACol in [1,4,6,7]) then
    Display(sgRegis, sgRegis.Cells[ACol, ARow]);
end;
...:cat:...

MathiasSimmack 6. Aug 2004 22:01

Re: kleines D8 Programm
 
Zitat:

Zitat von sakura
Works for me (in D8):

Vielleicht sollte man mal über eine Änderung des Smileys nachdenken. Passiert bei (Win98 ) nämlich auch, wenn man kein Leerzeichen setzt. @Daniel: ?

Daniel 6. Aug 2004 22:06

Re: kleines D8 Programm
 
Zitat:

Zitat von MathiasSimmack
@Daniel: ?

STATUS
Delphi-PRAXiS.net has confirmed that this is a bug in the Delphi-PRAXiS.net products that are listed (or not) at the beginning of this article.


:mrgreen:
Ich kann das so abändern, dass ein Leerzeichen davor und dahinter gefordert wird.

MathiasSimmack 6. Aug 2004 22:21

Re: kleines D8 Programm
 
Ist zwar off-topic, aber gibt´s nicht andere Möglichkeiten? Wie wäre es statt Kürzel mit einem Begriff à la ": evil :" .... meinetwegen ":glasses:", oder so.

Hansa 7. Aug 2004 11:28

Re: kleines D8 Programm
 
:warn: Müßt ihr meinen schönen Thread direkt schon versauen ? :mrgreen: Wegen den paar 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) Nur Neulinge wie Sakura fallen noch darauf rein. :stupid: Mal sehen ob sein (D 8) Programm läuft. Gut aussehen tut es auf den ersten Blick. .Net scheint allerdings sehr langsam zu sein (oder eben D 8). :lol:

Bernhard Geyer 7. Aug 2004 11:40

Re: kleines D8 Programm
 
Zitat:

Zitat von Hansa
.Net scheint allerdings sehr langsam zu sein (oder eben D 8). :lol:

.NET ist nicht langsam (Jedenfalls nicht prinzipbedingt). Teilweise um 50% schneller als ein entsprechenden D6/7-Programm.
Der erste Aufruf eines Programms kann dauern (Startzeit von .NET-Framework).
D8 mit VCL ist prinzipbedingt langsam (sehr viele P/Invoke-Aufrufe in VCL nötig. Und die dauern aufgrund der Sicherheitsüberprüfung).

Alexander 7. Aug 2004 11:46

Re: kleines D8 Programm
 
Die Programme an sich sind wirklich nicht langsam, im Gegenteil. Aber D8 selber ist es :mrgreen: :roll:

Bernhard Geyer 7. Aug 2004 11:48

Re: kleines D8 Programm
 
Das stimmt. Aber mit 2,6 GHz und 2 GB Ram merkt man sowas nicht so schnell 8)

Hansa 7. Aug 2004 11:53

Re: kleines D8 Programm
 
Das hier wird jetzt der 8) Thread. 8) :mrgreen: Denn eines ist schoon klar 8) Sakuras Programm läßt sich zwar compilieren, aber es macht nicht was die Vorgabe war. 8) Rechtsbündig ist da nix. 8)


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:55 Uhr.
Seite 1 von 2  1 2      

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