daily pastebin goal
20%
SHARE
TWEET

Untitled

a guest Jun 20th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, StdCtrls, ExtCtrls;
  8.  
  9. type
  10.   TMeuPanel = class(TPanel)
  11.     procedure DblClick(Sender: TObject);
  12.   public
  13.     constructor Create(AOwner: TComponent); reintroduce;
  14.     destructor Destroy; override;
  15.  
  16.     procedure Remover;
  17.   end;
  18.  
  19.   TForm1 = class(TForm)
  20.     Button1: TButton;
  21.     ScrollBox1: TScrollBox;
  22.     procedure Button1Click(Sender: TObject);
  23.   private
  24.     { Private declarations }
  25.     topLabel: Integer;
  26.   public
  27.     { Public declarations }
  28.     constructor Create(AOwner: TComponent); reintroduce;
  29.   end;
  30.  
  31. var
  32.   Form1: TForm1;
  33.  
  34. implementation
  35.  
  36. {$R *.dfm}
  37.  
  38. { TMeuPanel }
  39.  
  40. constructor TMeuPanel.Create(AOwner: TComponent);
  41. begin
  42.   inherited Create(AOwner);
  43.  
  44.   OnDblClick := DblClick;
  45. end;
  46.  
  47. procedure TMeuPanel.DblClick(Sender: TObject);
  48. begin
  49.   Remover;
  50. end;
  51.  
  52. destructor TMeuPanel.Destroy;
  53. begin
  54.   Caption := 'Excluido';
  55.   inherited;
  56. end;
  57.  
  58. procedure TMeuPanel.Remover;
  59. begin
  60.   Destroy;
  61.   //PostMessage(Handle, WM_DESTROY, 0, 0);
  62.   //SendMessage(Handle, WM_DESTROY, 0, 0);
  63.   //Perform(WM_DESTROY, 0, 0);
  64. end;
  65.  
  66. procedure TForm1.Button1Click(Sender: TObject);
  67. var
  68.   Panel: TMeuPanel;
  69. begin
  70.   Panel := TMeuPanel.Create(Self);
  71.   Panel.Parent := ScrollBox1;
  72.   Panel.Top := topLabel;
  73.   Panel.Height := 15;
  74.   Panel.Caption := 'Label' + IntToStr(topLabel);
  75.  
  76.   topLabel := topLabel + Panel.Height + 8;
  77. end;
  78.  
  79. constructor TForm1.Create(AOwner: TComponent);
  80. begin
  81.   inherited Create(AOwner);
  82.  
  83.   topLabel := 8;
  84. end;
  85.  
  86. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top