Custom Draw is disappearing on Zoom  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
Lambchop
User
Posts: 34
Joined: Mon May 02, 2022 5:58 pm

Custom Draw is disappearing on Zoom

Post by Lambchop »

Attached is a C# project you guys put together for me several months ago (CUSTOM TOOL BUTTON). I have several problems that I still cannot fix in the code. Using your sample project, can you tell me how to do the following:
1) how do I maintain the regions highlighted because they disappear upon any kind of Zoom In or Zoom Out?
2) how can I loop through the regions without having to maintain an array index like it does now? i.e. loop through and identify them as objects on the page like a field or a draw object.
3) how can I get the regions to respond to a unique mouse click combination? e.g. double click, or right mouse click to pull up a separate menu.
This feedback is super important for me at this stage. I am really desperate to resolve these issues as soon as possible.
Best Wishes and Many Thanks!
-Eric
FullDemo.CustomTool.zip
(130.63 KiB) Downloaded 65 times
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Custom Draw is disappearing on Zoom  SOLVED

Post by Vasyl-Tracker Dev Team »

Hi Eric.
1) how do I maintain the regions highlighted because they disappear upon any kind of Zoom In or Zoom Out?
- in the PagesMarkupTool::OnDeactivate method - just remove the code that clears that regions.
2) how can I loop through the regions without having to maintain an array index like it does now? i.e. loop through and identify them as objects on the page like a field or a draw object.
- that regions are virtual, and not part of document's page content, and are maintained only by your PagesMarkupTool-object. And to identify each region 'personally' not by just pair of indexes like {pageIndex, regionIndex} but by unique name for example(if you want) - you may expand/improve the simple:

Code: Select all

public class PageRegions
{
      public int pageIndex;
      public List<PXC_Rect> rects;
}
to a little bit complex:

Code: Select all

public class PageRegion
{
     string uniqName; // GUID?
     PXC_Rect rect;
}
public class PageRegions
{
      public int pageIndex;
      public List<PageRegion> items;
}
- and then add code to find the region by uniqName, etc. All is up to you...
3) how can I get the regions to respond to a unique mouse click combination? e.g. double click, or right mouse click to pull up a separate menu.
You need to work with PagesMarkupTool::OnProcessViewEvent. To show your own context menu for the right-clicked region you need to handle the:
WM_CONTEXTMENU = 0x007B
or even:
WM_RBUTTONUP = 0x0205
Note: to prevent running the default msg-handler you need to set the pEvent.bHadled to true.
The code for dbl-click is:
WM_LBUTTONDBLCLK = 0x0203

Other mouse-event codes you may find there:
https://learn.microsoft.com/en-us/windo ... ifications

===

HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply