logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Post a reply
From:
Message:

Maximum number of characters in each post is: 32767
Bold Italic Underline   Highlight Quote Choose Language for Syntax Highlighting Insert Image Insert an existing Attachment or upload a new File... Create Link   Unordered List Ordered List   Left Justify Center Justify Right Justify   Outdent Indent   More BBCode Tags
Font Color Font Size
Security Image:
Enter The Letters From The Security Image:
  Preview Post Cancel

Last 10 Posts (In reverse order)
Paul Rayman Posted: Monday, April 16, 2018 11:02:57 PM(UTC)
 
To change highlight color of the all fields you may use PdfViewer.FormHighlightColor Property
Code:

FormHighlightColor = Color.FromArgb(25, 255, 0, 0);


If you want to highlight separate field you may try the following
1. Create derived class based on PdfViewer
2. Override one of the drawing methods - DrawCurrentPageHighlight for example
3. Override OnFormsInvalidate method
4. Store the area marked to painting (invalidate area)
5. Highlight that area at the drawing stage

Code:

public class MyPdfViewer : PdfViewer
{
    protected override void OnInitialized(EventArgs e)
    {
        base.OnInitialized(e);

        FormHighlightColor = Color.FromArgb(25, 255, 0, 0);
    }

    internal static int ToArgb(Color color)
    {
        return (color.A << 24) | (color.R << 16) | (color.G << 8) | color.B;
    }

    private FS_RECTF _invalidateRect = default(FS_RECTF);
    protected override void OnFormsInvalidate(InvalidatePageEventArgs e)
    {
        base.OnFormsInvalidate(e);
        _invalidateRect = e.Rect;
    }

    protected override void DrawCurrentPageHighlight(DrawingContext drawingContext, int pageIndex, Rect actualRect)
    {
        base.DrawCurrentPageHighlight(drawingContext, pageIndex, actualRect);

        var ptTopLeft = PageToClient(pageIndex, new Point(_invalidateRect.left, _invalidateRect.top));
        var ptRightBottom = PageToClient(pageIndex, new Point(_invalidateRect.right, _invalidateRect.bottom));
        Rect rect = new Rect(ptTopLeft, ptRightBottom);
        drawingContext.DrawRectangle(new SolidColorBrush(Color.FromArgb(30, 0, 255,0)), null, rect);
    }
}
matt.smokeball Posted: Monday, April 16, 2018 5:06:21 PM(UTC)
 
Hi

I'm currently running an eval on the WPF product for some POC.

Part of the requirement I have is to be able to change the background color of the selected field/control, so it's more easily visible to the user. The properties on the control object are all read only. Is there anyway to do this using the viewer or code?

Also, it seems that when tabbing through the fields, it will go back to the top of the page when tabbing from the last field on the page. Is there anyway to make it to to the first field on the next page instead?



Thanks