public override void Update(Graphics graphics, WorkflowLayout.LayoutUpdateReason reason) { }
public override void Update(Graphics graphics, WorkflowLayout.LayoutUpdateReason reason) { if (reason != WorkflowLayout.LayoutUpdateReason.ZoomChanged) { Size size5; if (graphics == null) { throw new ArgumentException("graphics"); } Size margin = WorkflowTheme.CurrentTheme.AmbientTheme.Margin; Size paperSize = this.GetPaperSize(graphics); Margins adjustedMargins = this.GetAdjustedMargins(graphics); Size size2 = (base.parentView.RootDesigner != null) ? base.parentView.RootDesigner.Size : Size.Empty; if (!size2.IsEmpty) { Size selectionSize = WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize; size2.Width += 3 * selectionSize.Width; size2.Height += 3 * selectionSize.Height; } if (this.printDocument.PageSetupData.AdjustToScaleFactor) { this.scaling = ((float)this.printDocument.PageSetupData.ScaleFactor) / 100f; } else { Size size4; size4 = new Size(paperSize.Width - (adjustedMargins.Left + adjustedMargins.Right), paperSize.Height - (adjustedMargins.Top + adjustedMargins.Bottom)) { Width = Math.Max(size4.Width, 1), Height = Math.Max(size4.Height, 1) }; PointF tf = new PointF((this.printDocument.PageSetupData.PagesWide * size4.Width) / ((float)size2.Width), (this.printDocument.PageSetupData.PagesTall * size4.Height) / ((float)size2.Height)); this.scaling = Math.Min(tf.X, tf.Y); this.scaling = (float)(Math.Floor((double)(this.scaling * 1000.0)) / 1000.0); } this.pageSize = paperSize; this.pageSize.Width = Convert.ToInt32(Math.Ceiling((double)(((float)this.pageSize.Width) / this.scaling))); this.pageSize.Height = Convert.ToInt32(Math.Ceiling((double)(((float)this.pageSize.Height) / this.scaling))); IDesignerOptionService service = base.serviceProvider.GetService(typeof(IDesignerOptionService)) as IDesignerOptionService; if (service != null) { object optionValue = service.GetOptionValue("WinOEDesigner", "PageSeparator"); this.PageSeparator = (optionValue != null) ? ((Size)optionValue) : DefaultPageSeparator; } this.PageSeparator = new Size(Convert.ToInt32(Math.Ceiling((double)(((float)this.PageSeparator.Width) / this.scaling))), Convert.ToInt32(Math.Ceiling((double)(((float)this.PageSeparator.Height) / this.scaling)))); this.PageMargins = adjustedMargins; this.PageMargins.Left = Convert.ToInt32((float)(((float)this.PageMargins.Left) / this.scaling)); this.PageMargins.Right = Convert.ToInt32((float)(((float)this.PageMargins.Right) / this.scaling)); this.PageMargins.Top = Convert.ToInt32((float)(((float)this.PageMargins.Top) / this.scaling)); this.PageMargins.Bottom = Convert.ToInt32((float)(((float)this.PageMargins.Bottom) / this.scaling)); this.headerFooterMargins.Top = Convert.ToInt32((float)(((float)this.printDocument.PageSetupData.HeaderMargin) / this.scaling)); this.headerFooterMargins.Bottom = Convert.ToInt32((float)(((float)this.printDocument.PageSetupData.FooterMargin) / this.scaling)); this.previewTime = DateTime.Now; size5 = new Size(this.pageSize.Width - (this.PageMargins.Left + this.PageMargins.Right), this.pageSize.Height - (this.PageMargins.Top + this.PageMargins.Bottom)) { Width = Math.Max(size5.Width, 1), Height = Math.Max(size5.Height, 1) }; this.rowColumns.Width = size2.Width / size5.Width; this.rowColumns.Width += ((size2.Width % size5.Width) > 1) ? 1 : 0; this.rowColumns.Width = Math.Max(1, this.rowColumns.Width); this.rowColumns.Height = size2.Height / size5.Height; this.rowColumns.Height += ((size2.Height % size5.Height) > 1) ? 1 : 0; this.rowColumns.Height = Math.Max(1, this.rowColumns.Height); this.pageLayoutInfo.Clear(); for (int i = 0; i < this.rowColumns.Height; i++) { for (int j = 0; j < this.rowColumns.Width; j++) { Point empty = Point.Empty; empty.X = (j * this.pageSize.Width) + ((j + 1) * this.PageSeparator.Width); empty.Y = (i * this.pageSize.Height) + ((i + 1) * this.PageSeparator.Height); Point location = Point.Empty; location.X = empty.X + this.PageMargins.Left; location.Y = empty.Y + this.PageMargins.Top; Rectangle logicalPageBounds = new Rectangle(j * size5.Width, i * size5.Height, size5.Width, size5.Height); Rectangle pageBounds = new Rectangle(empty, this.pageSize); Rectangle viewablePageBounds = new Rectangle(location, size5); this.pageLayoutInfo.Add(new PageLayoutData(logicalPageBounds, pageBounds, viewablePageBounds, new Point(j, i))); } } } }