in

C1 Community

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

Samples (updated June 12, 2008)

Last post 09-04-2008 8:00 PM by C1_Dima. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 03-19-2008 4:03 PM

    Samples (updated June 12, 2008)

    I thought I'd start a separate sticky thread for easy access to samples. As time goes by I will be adding more samples here. Everybody else is more than welcome to add their own interesting samples as replies to this post. You may also reply with sample-related questions, but I reserve the right to trim or delete such replies to keep this thread concise and to the point.

    • TagsSample.zip - shows how to use tags to update a document's content after it has been created.
    • OverlaySample.zip - shows the use of overlay and watermark.
    • SubDocuments.zip - shows how to make sub-documents, with their own internal page numbering.
    • ToolbarButtonsOverride.zip - shows how to override the default preview toolbar buttons' actions, or hide some buttons altogether.
    • TocInLongDoc.zip - shows how to generate a complex TOC (with headers that are not hyperlinks) and put it in front of a document.
    • SubDocuments2.zip - based on SubDocuments above, shows how to mark some objects when the document is created, and then in the generated document find pages containing those objects. Also shows how to use PrintManager to send a document to printer directly.
    • MousePositionOnPage.zip - shows how to use C1PreviewPane.ClientToDocument to convert preview control's client coordinates into document page number and position on that page.
    • InvoiceSample.zip - shows one way of building an invoice-like document.
    Cheers,
    Dima.
  • 05-24-2008 12:40 AM In reply to

    • rkamp
    • Not Ranked
    • Joined on 06-06-2006
    • Posts 6

    Re: Samples (updated Apr 2, 2008)

    Dima,

    Thanks for the nice examples.  Is the any way to render the text of the Watermark or Overlay as an outline of the font?     This watermark is a bit intrusive if there is a lot of graphics on the page.

     

    Regards,

    Rick

  • 05-26-2008 2:58 PM In reply to

    Re: Samples (updated Apr 2, 2008)

    C1Preview does not provide its own "outline text" feature (such as a style property for example), but it is easy to draw outlined text using GDI+ into a RenderGraphics object, and then use it as the watermark. Attached is a small sample, with GDI+ code taken from the Bob Powell's GDI+ FAQ. Hope this helps.

    Cheers,
    Dima.
  • 08-06-2008 4:55 PM In reply to

    Re: Samples (updated June 12, 2008)

    Several years ago there was a PrintForm sample which showed how to print a general form using the RenderBlockControlImage(form1). Is this functionality possible with the new library and is there a sample somewhere that illustrates how to implement such a program? The new RenderBlock method does not seem to support rendering a form.

     

  • 09-04-2008 8:00 PM In reply to

    Re: Samples (updated June 12, 2008)

    Use RenderImage.Control property for this:

            public Control RenderImage.Control {get;set;}

            Gets or sets a System.Windows.Forms.Control object,
            an image of which is rendered by the current RenderImage object.


            The C1.C1Preview.Style.ClientAreaOnly property on the C1.C1Preview.RenderObject.Style
            of the current RenderImage object determines whether the whole control, or just its client area,
            is rendered.

            Note that this property does not cause the current object to render a real live control
            that can be used for user input, only a visual image representing the specified control.
            For real control behavior, see <RenderInputBase and derived classes.

    For instance, the following code previews a document with a snapshot of the form containing c1PrintPreviewControl1:

      private void button1_Click(object sender, EventArgs e)
      {
        RenderImage form = new RenderImage();
        form.Control = this;

        C1PrintDocument doc = new C1PrintDocument();
        doc.Body.Children.Add(aa);
        this.c1PrintPreviewControl1.Document = doc;
      }

    Hope this helps.

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