soft-c
پنج شنبه 08 فروردین 1392, 20:50 عصر
سلام
کامپوننت dblookuplistbox ، اسکرول بار دارد ولی با کلیک کردن روی آن بالا و پایین می رود .
من می خواهم با چرخش موس اسکرول بالا و پایین برود . کسی می تونه راهنمایی کنه؟
تشکر..
یوسف زالی
جمعه 09 فروردین 1392, 00:16 صبح
کرک کنید.
(این یکی از روشهاست)
برای این کار نیاز به دو یونیت دارید.
unit Unit3;
interface
uses
DBCtrls;
type
_TDBLookupListBox = class(TDBLookupListBox)
end;
implementation
end.
و
unit Unit2;
interface
uses Messages, Windows, Unit3;
type
TDBLookupListBox = class(_TDBLookupListBox)
protected
procedure WndProc(var Message : TMessage); override;
end;
implementation
uses Controls;
{ TButton }
procedure TDBLookupListBox.WndProc(var Message: TMessage);
begin
inherited;
if Message.Msg = WM_MOUSEWHEEL then
begin
Message.lParam := 0;
Message.Msg := WM_KEYDOWN;
If Message.wParam > 0 then // wheel roll up
Message.wParam := VK_UP
else // wheel roll down
Message.wParam := VK_DOWN;
Perform(Message.Msg, Message.wParam, Message.lParam); // go next or perior
Message.Msg := WM_KEYUP; // key up for refresh
end
end;
end.
حالا <<<باید>>> این یونیت رو به عنوان آخرین یونیت در Uses اول فرمتون استفاده کنید.
(در حقیقت کافیه یعد از DBCtrls قرار بگیره)
و تمام!!
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DBCtrls, DB, ADODB, Grids, DBGrids, Unit2;
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.