Ok let me explain in detail
To be precise as showed in the three screenshots the viewer on the right and thumbnail on the left don't sync up
The sticky note appears on the thumbnail in the left but not on the viewer on the right (StickyNote.JPG)
Similarly the rubber stamp appears on the thumbnail and not on the viewer. (RubberStamp.JPG)
In this situation when I click on the cancel is when we get the empty viewer. (Canel.JPG)
I have an alternative meaning
https://www.gdpicture.com/guides/gdpicture/GdP ... edraw.html
Adding this Redraw() helps after adding sticky note and rubber stamp. But Redraw might be a very costly operation if I were to redraw a big document about more than 100 pages. I would like to understand why redraw() was needed before adding this line of code. I tried with just redrawItem and didnt help. Thank you for looking at this.
This is the code to Add a sticky note, sticky note.
Code: Select all
private void bciRubberStamp_CheckedChanged(object sender, ItemClickEventArgs e)
{
this.gdViewer1.HideTextEditBox(true);
if (this.bciRubberStamp.Checked)
{
this.AddRubberStamp();
this.gdViewer1_PageChanged();
//I had the add the 2 lines below for the stamp to actually sync on both thumbnail and viewer
this.gdViewer1.Redraw();
this.thumbnailEx1.RedrawItem(this.DocumentImageViewModel.CurrentPageIndex);
}
}
Code: Select all
public void AddRubberStamp()
{
this.BeforeAnnotation();
this.AnnotationManager.SelectPage(this.CurrentPageNumber);
var color = Color.FromArgb(this.CurrentRubberStamp.Color);
var left = (float)this.CurrentRubberStamp.LocationLeft.GetValueOrDefault();
var top = (float)this.CurrentRubberStamp.LocationTop.GetValueOrDefault();
var width = (float)this.CurrentRubberStamp.SizeWidth.GetValueOrDefault();
var height = (float)this.CurrentRubberStamp.SizeHeight.GetValueOrDefault();
var text = this.CurrentRubberStamp.DefaultText;
var rubberStamp = this.AnnotationManager.AddRubberStampAnnot(color, left, top, width, height, text);
rubberStamp.Subject = StringUtil.GetEnumDescription(AnnotationStyleTypes.RubberStamp);
rubberStamp.Tag = Guid.NewGuid().ToString().ToUpper();
rubberStamp.Opacity = (float)this.CurrentRubberStamp.Opacity.GetValueOrDefault();
rubberStamp.CanMove = this.CurrentRubberStamp.IsMovable;
rubberStamp.CanResize = this.CurrentRubberStamp.IsResizable;
rubberStamp.CanRotate = this.CurrentRubberStamp.IsRotatable;
rubberStamp.CanSelect = this.CurrentRubberStamp.IsSelectable;
rubberStamp.Author = this.BuildAnnotationAuthors(rubberStamp.Author);
this.SaveAnnotationsToPage(this.CurrentPageNumber);
this.AfterAnnotation();
}
Code: Select all
#region SaveAnnotationsToPage
private void SaveAnnotationsToPage(int page, bool burn = false)
{
this.AnnotationManager.SaveAnnotationsToPage();
if (burn)
{
this.AnnotationManager.BurnAnnotationsToPage(true);
}
this.GdViewer.ReloadAnnotations();
this.GdViewer.Redraw();
this.ThumbnailEx.RedrawItem(page - 1);
}
#endregion
Code: Select all
#region AddStickyNote
public void AddStickyNote()
{
this.BeforeAnnotation();
this.AnnotationManager.SelectPage(this.CurrentPageNumber);
var left = (float)this.CurrentStickyNote.LocationLeft.GetValueOrDefault();
var top = (float)this.CurrentStickyNote.LocationTop.GetValueOrDefault();
var width = (float)this.CurrentStickyNote.SizeWidth.GetValueOrDefault();
var height = (float)this.CurrentStickyNote.SizeHeight.GetValueOrDefault();
var text = this.CurrentStickyNote.DefaultText;
var stickyNote = this.AnnotationManager.AddStickyNoteAnnot(left, top, width, height, text);
stickyNote.Subject = StringUtil.GetEnumDescription(AnnotationStyleTypes.StickyNote);
stickyNote.Tag = Guid.NewGuid().ToString().ToUpper();
stickyNote.FillColor = Color.FromArgb(this.CurrentStickyNote.Color);
stickyNote.Opacity = (float)this.CurrentStickyNote.Opacity.GetValueOrDefault();
stickyNote.FontName = this.CurrentStickyNote.FontName;
stickyNote.FontSize = this.CurrentStickyNote.FontSize.GetValueOrDefault();
stickyNote.ForeColor = Color.FromArgb(this.CurrentStickyNote.FontColor.GetValueOrDefault());
stickyNote.CanMove = this.CurrentStickyNote.IsMovable;
stickyNote.CanResize = this.CurrentStickyNote.IsResizable;
stickyNote.CanRotate = this.CurrentStickyNote.IsRotatable;
stickyNote.CanSelect = this.CurrentStickyNote.IsSelectable;
stickyNote.Author = this.BuildAnnotationAuthors(stickyNote.Author);
this.SaveAnnotationsToPage(this.CurrentPageNumber);
this.AfterAnnotation();
Guid annotationId;
var activity = new DocumentActivityDetail
{
SystemActivityTypeId = (int)SystemActivityTypes.AnnotationAdd,
PageDescription = string.Format("on page {0} - {1}", this.CurrentPageNumber, stickyNote.Subject),
TransactionId = Guid.TryParseExact(stickyNote.Tag, "D", out annotationId) ? annotationId : new Guid()
};
this.documentActivityDetailList.Add(activity);
}
#endregion
Code: Select all
#region AfterAnnotation
private void AfterAnnotation()
{
this.GdViewer.LockViewer = false;
this.ThumbnailEx.LockGdViewerEvents = false;
this.ThumbnailEx.PauseThumbsLoading = false;
this.ThumbnailEx.SelectItem(this.savedCurrentPageIndex);
this.GdViewer.DisplayPage(this.savedCurrentPageIndex + 1);
this.CurrentPageIndex = this.savedCurrentPageIndex;
this.RestoreDisplayArea();
}
#endregion