Форум: "KOL";
Текущий архив: 2010.02.07;
Скачать: [xml.tar.bz2];
ВнизКрутим колесико над 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 вся ветка
Форум: "KOL";
Текущий архив: 2010.02.07;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.003 c