Il titolo non è molto chiaro, lo so.
In pratica l'idea è quella di creare un TForm customizzato (per farne un popup alla google desktop per intenderci).
Ho creato la classe derivata da TForm
E volevo crearlo a run-time durante l'esecuzione del programma (ad esempio al click di un bottone).codice:unit mypopup; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TPopForm = class(TForm) pnlText, pnlTitle: TPanel; LblTitle, LblText : TLabel; public constructor Create(AOwner: TComponent); override; end; implementation constructor TPopForm.Create(AOwner: TComponent); var Desktop: TRect; begin inherited Create(AOwner); Height := 120; Width := 300; if SystemParametersInfo(SPI_GETWORKAREA,0,@Desktop,0) then begin Left := Desktop.Right - Width; Top := Desktop.Bottom - Height; end; pnlTitle.Align := alTop; pnlTitle.Height := 20; pnlTitle.Color := $00ff0000; LblTitle.Parent := pnlTitle; end; end.
Però se lo costruisco così:
p:= TPopForm.Create(Form1); mi da "TPopForm Resource not found"
mentre se lo costruisco così
p.Create(Form1); mi dà stack overflow. In cosa sbaglio?![]()


Rispondi quotando


