Вниз
Скачать: CL | DM;

Крутим колесико над PaintBox   Найти похожие ветки 

 
Vinum   (2008-05-20 23:18) [0]

Здравствуйте. Подскажите пожалуйста как мне определить направление вращения колеса мыши над PaintBox.


 
Дмитрий К ©   (2008-05-21 00:12) [1]

program Project1;

uses
 Windows, KOL;

var Form, PB: PControl;

procedure FormMouseWheel(Dummy, Sender: PControl; var Mouse: TMouseEventData);
var zDelta: SmallInt; r:TRect; p: TPoint;
begin
 GetWindowRect(PB.Handle, r);
 GetCursorPos(p);
 if PointInRect(p, r) then
 begin
   zDelta := HiWord(Mouse.Shift);
   if zDelta < 0 then
   begin
     PB.Width := PB.Width - 10;
     PB.Height := PB.Height - 10;
   end
   else begin
     PB.Width := PB.Width + 10;
     PB.Height := PB.Height + 10;
   end;
 end;
end;

procedure PBPaint(Dummy, Sender: PControl; DC: HDC);
begin
 Sender.Canvas.FillRect(Sender.BoundsRect);
end;

begin
 Form := NewForm(nil, "test");
 PB := NewPaintBox(Form);
 PB.Canvas.Brush.Color := clRed;
 PB.OnPaint := TOnPaint(MakeMethod(nil, @PBPaint));
 Form.OnMouseWheel := TOnMouse(MakeMethod(nil, @FormMouseWheel));

 Run(Form);
end.


 
Vinum   (2008-05-21 07:54) [2]

Большое спасибо



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.006 c
3-1234507272
matveih1
2009-02-13 09:41
2010.02.07
ibconsvc.exe


11-1211058152
foxnsk
2008-05-18 01:02
2010.02.07
Определение событий средствами MCK


4-1228802818
DimonS
2008-12-09 09:06
2010.02.07
Как реализовать чтение iButton?


2-1260668640
andrewtitoff
2009-12-13 04:44
2010.02.07
БД


11-1210599832
Valera
2008-05-12 17:43
2010.02.07
Проблема со ScrollBox.




   Наверх