1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
   | unit Unit1;
 
{$mode objfpc}{$H+}
 
interface
 
uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
  //Added
  LCLIntf, LCLType, LMessages, ExtCtrls, StdCtrls;
 
type
 
  { TForm1 }
 
  TForm1 = class(TForm)
    ApplicationProperties1: TApplicationProperties;
    Button1: TButton;
    Label1: TLabel;
    Panel1: TPanel;
    procedure ApplicationProperties1UserInput(Sender: TObject; Msg: cardinal);
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Panel1Click(Sender: TObject);
  private
 
  public
 
  end;
 
var
  Form1: TForm1;
  i: integer;
 
implementation
 
{$R *.lfm}
 
procedure TForm1.ApplicationProperties1UserInput(Sender: TObject; Msg: cardinal);
begin
  if Msg = LM_LBUTTONDOWN then
  begin
    if i = 1 then
    begin
      ReleaseCapture();
      SendMessage(Self.Handle, LM_NCLButtonDown, HTCaption, 0);
      Inc(i);
      label1.Caption := IntToStr(i);
    end;
    // else
    //  SendMessage(Self.Handle ,LM_NCLButtonDown, HTCLIENT, 0);
  end;
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
  Inc(i);
  label1.Caption := IntToStr(i);
  ShowMessage('Button ' + IntToStr(i));
 
end;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
  i := 0;
  label1.Caption := IntToStr(i);
end;
 
procedure TForm1.Panel1Click(Sender: TObject);
begin
  Inc(i);
  label1.Caption := IntToStr(i);
  ShowMessage('Panel ' + IntToStr(i));
end;
 
end. | 
Partager