How I can personate apperance of pop-up windows? I would like to
build my own windows for sticky note when I'm in edition mode.
Thanks
How I can personate apperance of pop-up windows? I would like to
build my own windows for sticky note when I'm in edition mode.
Thanks
To implement your own version of sticky notes you can derive a class
from PDFViewCtrl and override a few event handlers. For example, the
following code overrides mouse double-click event which PDFViewCtrl
uses to open popup windows on sticky note annotations. You can handle
these events in a similar fashion to open your own popup window or to
implement any other type of action.
public class MyPDFView : PDFViewCtrl
{
protected override void OnMouseDoubleClick(MouseEventArgs e) {
int page_num = GetPageNumberFromScreenPt(e.X, e.Y);
bool processed = false;
if( page_num < 1 ) return;
// Find the click point in page coordinate system...
double x = e.X;
double y = e.Y;
ConvScreenPtToPagePt(ref x, ref y, page_num);
// Loop over annotations on page and check if the click
// landed inside one of the sticky note annotations.
// In that case, we pop up a custom message box.
Page page = GetDoc().GetPage(page_num);
int annot_num = page.GetNumAnnots();
for (int i = 0; i < annot_num; ++i) {
Annot annot = page.GetAnnot(i);
if (annot.IsValid() == false || annot.GetType() !=
Annot.Type.e_Text) continue;
Rect box = annot.GetRect();
if (box.Contains(x, y)) {
processed = true;
MessageBox.Show("Sticky Note Popup", "Open your own sticky
note popup here");
}
}
// If we had not done anything, allow processing of the event in
the base class.
if (!processed) base.OnMouseDoubleClick(e);
}
}
As a starting point for you may want to go over PDFView sample project
(http://www.pdftron.com/pdfnet/samplecode.html#PDFView) which
implements a number of custom tools (e.g. markup, link creation, etc -
in MyPDFView.cp) and various customizations to the base PDFViewCtrl.
Thanks for your response.
And how can I move my own popup when the page scroling?
Thanks