Недавно добавленные исходники

•  DeLiKaTeS Tetris (Тетрис)  4 308

•  TDictionary Custom Sort  6 358

•  Fast Watermark Sources  6 144

•  3D Designer  9 088

•  Sik Screen Capture  6 469

•  Patch Maker  6 887

•  Айболит (remote control)  6 864

•  ListBox Drag & Drop  5 743

•  Доска для игры Реверси  96 662

•  Графические эффекты  7 084

•  Рисование по маске  6 390

•  Перетаскивание изображений  5 257

•  Canvas Drawing  5 629

•  Рисование Луны  5 330

•  Поворот изображения  4 881

•  Рисование стержней  3 462

•  Paint on Shape  2 722

•  Генератор кроссвордов  3 598

•  Головоломка Paletto  2 891

•  Теорема Монжа об окружностях  3 699

•  Пазл Numbrix  2 432

•  Заборы и коммивояжеры  3 115

•  Игра HIP  2 072

•  Игра Go (Го)  2 001

•  Симулятор лифта  2 358

•  Программа укладки плитки  2 060

•  Генератор лабиринта  2 520

•  Проверка числового ввода  2 204

•  HEX View  2 534

•  Физический маятник  2 148

 
скрыть

  Форум  

Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



Delphi Sources

Несколько методов, обрабатывающих одно сообщение





unit ManyForm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TFormManyMess = class(TForm)
    LBox: TListBox;
    Label1: TLabel;
    Button1: TButton;
    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    procedure WndProc(var Message: TMessage); override;
    procedure DefaultHandler(var Message); override;
    procedure WmLButtonDown (var Message: TWMMouse);
      message wm_lButtonDown;
    procedure MouseDown(Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer); override;
    procedure ApplicationMessage (var Msg: TMsg;
      var Handled: Boolean);
  end;

var
  FormManyMess: TFormManyMess;

implementation

{$R *.DFM}

procedure TFormManyMess.FormMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState;
  X, Y: Integer);
begin
  if Button = mbLeft then
    LBox.Items.Add (Format ('%s in (%d, %d)',
      ['FormMouseDown', X, Y]));
end;

procedure TFormManyMess.WndProc(var Message: TMessage);
begin
  if Message.Msg = wm_LButtonDown then
    LBox.Items.Add (Format ('%s in (%d, %d)',
      ['WndProc', LoWord (Message.LParam),
      HiWord (Message.LParam)]));
  inherited;
end;

procedure TFormManyMess.DefaultHandler(var Message);
begin
  with TMessage (Message) do
    if Msg = wm_LButtonDown then
      LBox.Items.Add (Format ('%s in (%d, %d)',
        ['DefaultHandler', LoWord (LParam),
        HiWord (LParam)]));
  inherited;
end;

procedure TFormManyMess.WmLButtonDown (var Message: TWMMouse);
begin
  LBox.Items.Add (Format ('%s in (%d, %d)',
    ['WmLButtonDown', Message.XPos, Message.YPos]));
  inherited;
end;

procedure TFormManyMess.MouseDown(Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Button = mbLeft then
    LBox.Items.Add (Format ('%s in (%d, %d)',
      ['MouseDown', X, Y]));
  inherited;
end;

procedure TFormManyMess.ApplicationMessage (var Msg: TMsg;
  var Handled: Boolean);
begin
  if (Msg.Message = wm_LButtonDown) and
      (Msg.hWnd = Handle) then
    LBox.Items.Add (Format ('%s in (%d, %d)',
      ['ApplicationMessage', LoWord (Msg.LParam),
      HiWord (Msg.LParam)]));
  Handled := False;
end;

procedure TFormManyMess.FormCreate(Sender: TObject);
begin
  Application.OnMessage := ApplicationMessage;
end;

procedure TFormManyMess.Button1Click(Sender: TObject);
begin
  LBox.Clear;
end;



end.

Загрузить исходный код проекта








Copyright © 2004-2025 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

Группа ВКонтакте