|
|
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);
}
}
|
|
|
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
|
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close