Einzelnen Beitrag anzeigen

calibra301

Registriert seit: 20. Mär 2009
95 Beiträge
 
Delphi XE8 Professional
 
#6

AW: Instanzen eines Formulars...

  Alt 25. Jul 2022, 15:46
Hier mal das komplette Elend, nur in den Prozeduren etwas eingekürzt.

Delphi-Quellcode:

unit U_Catform;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;

 Type TPacPoint=packed record
    x,y,z:smallint;
    S2:Byte;
    S3:Byte;
    R,G,B:Byte;
 end;



 Type TCadpage=record
   n:integer;
   Marked:Boolean;
   Points:Array of TPacPoint;
 end;

type
  TCatForm = class(TForm)

    od1: TOpenDialog;
    GB1: TGroupBox;
    sb1: TScrollBar;
    E_SB: TEdit;
    BT_LoadCat: TButton;
    Label1: TLabel;
    E_Start: TEdit;
  public
    f:File;
    CAT:array[0..32767] of TCadpage;
    PImage:array[1..31] of TImage;
    Startindex:Word;

    procedure FormCreate(Sender: TObject);
    procedure BT_LoadCatClick(Sender: TObject);
    procedure sb1Change(Sender: TObject);
    procedure GB1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    Procedure Create_Images;
    Procedure Pics_Zeichnen(Pindex,CatIndex:integer);
  private

  public

  end;

implementation

{$R *.dfm}

procedure TCatForm.FormCreate(Sender: TObject);
begin
  Create_Images;
end;


Procedure TCatForm.Create_Images;
var i,z,s:integer;
Begin
  i:=1;
  for z := 1 to 4 do
  Begin
    for s := 1 to 6 do
    Begin
      PImage[i]:=TImage.Create(nil); // ???
      PImage[i].Parent:=GB1;
      PImage[i].Width :=128;
      PImage[i].Height:=128+16;
      PImage[i].Top :=15+( (z-1)*(128+16+16));
      PImage[i].Left :=10+( (s-1)*(128+16));
      PImage[i].Canvas.Brush.Color:=clblack;
      PImage[i].Canvas.FillRect(rect(0,0,128,128+16));
      PImage[i].Canvas.Brush.Color:=$A0A0A0;
      PImage[i].Canvas.FillRect(rect(0,128,128,128+16));
      PImage[i].OnMouseDown:=gb1mousedown; // ???
      PImage[i].Tag:=i-1;
      //PImage[i].Stretch:=true;
      i:=i+1;
    End;
  End;
End;

Procedure TCatForm.Pics_Zeichnen(Pindex,CatIndex:integer);
var i,ii:Integer;
    x,y,z:integer;
    pb,rp:byte;
    R,G,B:Byte;
    LastWasBlank:Boolean;
Begin
   //....Bilder aus Cat[index].points zeichnen
End;



procedure TCatForm.GB1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var i,pos:Integer;
begin
 Beep;
 if sender is TImage then
 Begin
   with sender as TImage do
   Begin
     pos:=tag;
   End;
 End;

 for i := 0 to 32767 do CAT[i].Marked:=false;
 CAT[pos].Marked:=true;
 sb1Change(self);
end;

procedure TCatForm.sb1Change(Sender: TObject);
var s,i:integer;
begin
  // Startindex der zu zeichnenden Bilder ändern
end;


procedure TCatForm.BT_LoadCatClick(Sender: TObject);
begin
  // ...Bilderdaten in CAT[Index] laden und dann zeichnen
  for i := 0 to 23 do
  Pics_Zeichnen(i+1,i);
end;

end.
  Mit Zitat antworten Zitat