Einzelnen Beitrag anzeigen

Nicodius

Registriert seit: 25. Apr 2003
Ort: Graz
2.234 Beiträge
 
Delphi 2006 Architect
 
#5

Re: Fehlermeldung beim beenden

  Alt 17. Okt 2004, 15:19
hab ich auch schon probiert ...


code

Delphi-Quellcode:
unit Info;

interface

uses Graphics,Forms, Main,
      ExtCtrls, ComCtrls, StdCtrls;

type
  TAusgabe = class
    Text : String;
    Titel : String;
    Bild : String;
    The_Sender : TObject;
  public
    procedure ShowIt(Sender : TObject);
    procedure OnFormClose(Sender: TObject; var Action: TCloseAction);
  end;
implementation

{ TAusgabe }

procedure TAusgabe.OnFormClose(Sender: TObject; var Action: TCloseAction);
begin
  TForm(Sender).Destroy;
end;

procedure TAusgabe.ShowIt;
var Ausgabe_Form : TForm;
    AusgabeLabel : TLabel;
    AusgabeImage : TImage;
begin
  if TImage(Sender) <> nil then
  begin
  
    Ausgabe_Form := TForm.Create(TImage(Sender).Parent);
    Ausgabe_Form.BorderStyle := bsdialog;
    Ausgabe_Form.FormStyle := fsstayontop;
    Ausgabe_Form.Width := 250;
    Ausgabe_Form.Height := 400;
    Ausgabe_Form.Left := Main_Form.Left + TImage(Sender).Left;
    Ausgabe_Form.Top := Main_Form.Top + TImage(Sender).Top + TImage(Sender).Height;
    Ausgabe_Form.Caption := Titel;
    Ausgabe_Form.Visible := true;
    Ausgabe_Form.Parent := TImage(Sender).Parent;

    AusgabeImage := TImage.Create(Ausgabe_Form);
    AusgabeImage.Picture := TImage(Sender).Picture;
    AusgabeImage.AutoSize := true;
    AusgabeImage.Left := (Ausgabe_Form.Width div 2) - (AusgabeImage.Width div 2);
    AusgabeImage.Top := 0;
    AusgabeImage.Visible := true;
    AusgabeImage.Parent := Ausgabe_Form;

    AusgabeLabel := TLabel.Create(Ausgabe_Form);
    AusgabeLabel.Caption := Text;
    AusgabeLabel.Font.Style := [fsbold];
    AusgabeLabel.AutoSize := true;
    AusgabeLabel.WordWrap := true;
    AusgabeLabel.Left := 0;
    AusgabeLabel.Top := AusgabeImage.Height+10;
    AusgabeLabel.Visible := true;
    AusgabeLabel.Parent := Ausgabe_Form;

    Ausgabe_Form.OnClose := OnFormClose;

end;
end;

end.

aufruf

Delphi-Quellcode:
procedure TMain_Form.ImageClick(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var Ausgabe : Info.TAusgabe;
begin
//if TProgressbar(Sender) = nil
//then
//begin
  case button of
    mbleft : begin
               Ausgabe.Titel := TImage(Sender).Hint;
               Ausgabe.Text := 'TEST';
               Ausgabe.ShowIt(Sender);
             end;
    mbmiddle : Showmessage('Mittlere');
    mbright : If Auftrag < 1 then
              begin
              MSender := Sender;
                if TImage(Sender).Hint = 'unbebaut'
                then
                  ImagePopup.Items[1].Enabled := false
                else
                  ImagePopup.Items[1].Enabled := true;

                if (TImage(Sender).Hint <> 'unbebaut')
                   or (Auftrag > 0)
                then
                  ImagePopup.Items[0].Enabled := false
                else
                  ImagePopup.Items[0].Enabled := true;

                ImagePopup.Popup(Main_Form.Left +
                TImage(Sender).Left,Main_Form.Top +
                TImage(Sender).Top + Y);
              end;
    end;
    ImagePopup.Items[0].Enabled := false;
//end
//else
// Showmessage(TImage(MSender).Hint);
end;
Nico Müller
  Mit Zitat antworten Zitat