ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to do mouse right to scroll
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Waheed

Kuwait
36 Posts

Posted - Aug 09 2021 :  23:25:57  Show Profile  Reply
I would like to imitate IrfanView left mouse to select, right mouse to scroll when zoomed in.
How can I do that? Select is easy, the problem is with right mouse to scroll.

-----------------
3 Monitors
Windows 10
Delphi 6,2007 and 10.2
ImageEn v.10.0.1

xequte

38189 Posts

Posted - Aug 10 2021 :  18:17:37  Show Profile  Reply
Hi Waheed

It would be something like:

In MouseDown set private fields

fScrolling  := Button = mbRight;
fMouseDownX := X;
fMouseDownY := Y;
fOrigViewX  := ImageEnView1.ViewX;
fOrigViewY  := ImageEnView1.ViewY;


In MouseMove:

if fScrolling then
  ImageEnView1.SetViewXY( fOrigViewX - trunc((X - fMouseDownX) * ImageEnView1.MouseScrollRate ), 
                          fOrigViewY - trunc((Y - fMouseDownY) * ImageEnView1.MouseScrollRate ));


In MouseUp:

fScrolling := False;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Waheed

Kuwait
36 Posts

Posted - Aug 10 2021 :  22:05:44  Show Profile  Reply
Does this mean I have to create a component based on TImageEnView and add these events to it? This doesn't cover Right mouse click.

A Demo is much more appreciated.

-----------------
3 Monitors
Windows 10
Delphi 6,2007 and 10.2
ImageEn v.10.0.1
Go to Top of Page

xequte

38189 Posts

Posted - Aug 11 2021 :  00:33:05  Show Profile  Reply
Hi

You should be able to just put that code in the mouse events of a TImageEnView on your form.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Waheed

Kuwait
36 Posts

Posted - Aug 11 2021 :  02:32:40  Show Profile  Reply
So, in the form private I declared:

fScrolling : boolean;
fMouseDownX, fMouseDownY, fOrigViewX, fOrigViewY: Integer;


In OnMouseDown :
if (Button = mbRight) then begin
      fScrolling  := True;
      fMouseDownX := X;
      fMouseDownY := Y;
      fOrigViewX  := ImageEnView1.ViewX;
      fOrigViewY  := ImageEnView1.ViewY;
   end;


That solved it.

Thanks
Go to Top of Page

xequte

38189 Posts

Posted - Aug 11 2021 :  22:27:31  Show Profile  Reply
Yes, that looks good.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: