in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

How to use "C1PreviewPane.PreviewAction" event?

Last post 03-07-2008 1:11 PM by C1_Dima. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 02-04-2008 8:43 AM

    How to use "C1PreviewPane.PreviewAction" event?

    Hi everybody!

    Could anybody explain how the "PreviewAction" event of C1PreviewPane works?

    What I want to achieve: I preview a C1FlexGridPrintable (a C1 flexgrid sample),
    which is modified to scale the grid data based on the paper size. So, if the
    page settings change, the zoom might have changed, and I have to recreate the
    full C1FlexGridPrintable. Now I need a good extension point to plug in this
    logic to the preview.
    I thought that the "PreviewAction" event is fired when e.g. the PageSettings
    Button is pressed, so that I could provide my own subclass of
    "ActionHandlerReflow", but this does not seem to happen.

    Does anybody have an idea on how to achieve what I want to do?

    Thanks

    Wolfgang
  • 02-04-2008 11:08 AM In reply to

    • C1_GregL
    • Top 10 Contributor
    • Joined on 06-11-2007
    • Pittsburgh PA
    • Posts 500

    Re: How to use "C1PreviewPane.PreviewAction" event?

    I don't think the toolbar buttons will trigger PreviewPane's PreviewAction event because they are part of the PrintPreviewControl base part. 

    If you want to capture the user clicking on a toolbar button you can access the toolbar events through code...

    AddHandler C1PrintPreviewControl1.ToolBars.File.ToolStrip.ItemClicked, AddressOf previewAction

    Private Sub previewAction(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs)
       MsgBox(e.ClickedItem.ToolTipText)
    End Sub

    that might help

    Greg L

     

     

  • 02-05-2008 7:23 AM In reply to

    Re: How to use "C1PreviewPane.PreviewAction" event?

    Hi Greg,

    this will not help much, because first the C1PrintPreviewControl default logic
    would run, and after this I can handle the click. This would mean that the
    document is rendered twice.

    I think I need this feature for the page settings click, and I would like to do
    this: use the default behaviour for showing the page settings dialog and setting
    the new page settings to the current document. Then I want to re-render the
    C1FlexGridPrintable with the new settings, and reflowing the document could
    again be done by the default logic.
    In my case, an event "PageSettingsChanged" of the preview control would help,
    which is fired after showing the dialog and before re-rendering the document. Do
    you think that something like this could be implemented? If yes I request to add
    it to the wish list.

    Best regards

    Wolfgang
  • 02-14-2008 12:30 PM In reply to

    • C1_GregL
    • Top 10 Contributor
    • Joined on 06-11-2007
    • Pittsburgh PA
    • Posts 500

    Re: How to use "C1PreviewPane.PreviewAction" event?

    Could you do this using a custom button?  You would have to create your own page settings dialog and call it when clicking your own button.

    I suggest emailing feedback@componentone.com with enhancements, or create a new thread which might be seen by the developers.

    Regards,

    Greg

  • 02-25-2008 8:44 AM In reply to

    Re: How to use C1PreviewPane.PreviewAction event?

    I will give this a try and use a custom button. Hope there is not too much done
    internally.

    Thanks

    Wolfgang
  • 02-27-2008 10:36 PM In reply to

    Re: How to use C1PreviewPane.PreviewAction event?

     To capture page settings' change, you can do this:

      C1PrintPreview pview = new C1PrintPreview();
      ...
      pview.PreviewPane.PropertyChanged += new PropertyChangedEventHandler(PreviewPane_PropertyChanged);
     

      void PreviewPane_PropertyChanged(object sender, PropertyChangedEventArgs e)
      {
        if (e.PropertyName == "PageSettings")
        {
          // your logic here
        }
      }

     

    Note that all preview controls' properties fire the common PropertyChanged event when changed.

    Hope this helps.
     

    Cheers,
    Dima.
  • 03-07-2008 10:05 AM In reply to

    Re: How to use C1PreviewPane.PreviewAction event?

    Thanks, Dima, this was a great tip. It did exactly what I needed!

    Wolfgang
  • 03-07-2008 1:11 PM In reply to

    Re: How to use C1PreviewPane.PreviewAction event?

     Glad to help. Thanks for letting me know that it works for you.

    Cheers,
    Dima.
Page 1 of 1 (8 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.