internal override void restoreProperties(ItemProperties props) { TableProperties tprops = (TableProperties)props; caption = tprops.caption; captionColor = tprops.captionColor; captionFormat = tprops.captionFormat; captionHeight = tprops.captionHeight; cellBorders = tprops.cellBorders; columnWidth = tprops.columnWidth; currScrollRow = tprops.currScrollRow; linkStyle = tprops.linkStyle; picture = tprops.picture; picturePos = tprops.picturePos; rowHeight = tprops.rowHeight; scrollable = tprops.scrollable; selStyle = tprops.selStyle; style = tprops.style; textColor = tprops.textColor; EnableStyledText = tprops.enableStyledText; customDraw = tprops.customDraw; cellCustomDraw = tprops.cellCustomDraw; if (captionBackBrush != tprops.captionBackBrush) { if (captionBackBrush != null) captionBackBrush.Release(); captionBackBrush = tprops.captionBackBrush; if (captionBackBrush != null) captionBackBrush.AddRef(); } base.restoreProperties(props); }
internal void draw(Graphics g, System.Drawing.Pen pen, System.Drawing.Brush textBrush, RectangleF rect, Font font, CellFrameStyle borders, int row, int column, RectangleF imgRect) { if (table.CellCustomDraw == CustomDraw.Full) { // call the custom draw function table.Parent.drawCell(g, table, column, row, rect); } else { // Paint cell with its own brush if specified if (brush != null && table.flowChart.RenderOptions.EnableInterior) { System.Drawing.Brush cellBrush = brush.CreateGDIBrush(rect); g.FillRectangle(cellBrush, rect); cellBrush.Dispose(); } // Draw cell picture if available if (picture != null) Utilities.drawImage(g, picture, imgRect, picturePos); // additional custom draw type if (table.CellCustomDraw == CustomDraw.Additional) table.Parent.drawCell(g, table, column, row, rect); // Paint the border switch (borders) { case CellFrameStyle.System3D: Rectangle rcDev = Utilities.docToDevice(g, rect); if (column == 0) { rcDev.X += 2; rcDev.Width -= 2; } ControlPaint.DrawBorder3D(g, rcDev, Border3DStyle.Sunken); break; case CellFrameStyle.Simple: g.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); break; } RectangleF textRect = rect; // DrawString crashes with a too small PageScale if (g.PageScale > 0.01 && text.Length > 0 && table.flowChart.RenderOptions.EnableText) { System.Drawing.Brush b = textBrush; if (textColor.A != 0) b = new System.Drawing.SolidBrush(textColor); if (table.EnableStyledText) { txLayout.Draw(textRect.Left, textRect.Top, new RenderTextCallback(DrawText), new DrawTextHint(g, font, b, nearFormat, Utilities.getTextEllipsis(textFormat))); } else { textRect.Inflate(-pen.Width / 2, -pen.Width / 2); g.DrawString(text, font, b, textRect, textFormat); } if (textColor.A != 0) b.Dispose(); } // additional2 custom draw type if (table.CellCustomDraw == CustomDraw.Additional2) table.Parent.drawCell(g, table, column, row, rect); } }
public override void loadFrom(BinaryReader reader, PersistContext ctx) { base.loadFrom(reader, ctx); hasHeaderRows = false; hasSpanningCells = false; ctx.loadReference(this); // load cells ctx.loadReference(this); // load rows ctx.loadReference(this); // load columns currScrollRow = reader.ReadInt32(); scrollable = reader.ReadBoolean(); setScrollable(scrollable); fillColor = ctx.loadColor(); frameColor = ctx.loadColor(); caption = reader.ReadString(); captionColor = ctx.loadColor(); captionFormat = ctx.loadStringFormat(); captionHeight = (float)reader.ReadDouble(); cellBorders = (CellFrameStyle)reader.ReadInt32(); rowsCount = reader.ReadInt32(); rowHeight = (float)reader.ReadDouble(); columnsCount = reader.ReadInt32(); columnWidth = (float)reader.ReadDouble(); textColor = ctx.loadColor(); picturePos = (ImageAlign)reader.ReadInt32(); picture = ctx.loadImage(); pen.Width = PenWidth; pen.Color = frameColor; pen.DashStyle = PenDashStyle; brush.Release(); brush = new SolidBrush(fillColor); brush.AddRef(); if (ctx.FileVersion > 3) { pen = (Pen)ctx.loadObject(); ctx.loadReference(this); selStyle = (HandlesStyle)reader.ReadInt32(); if (ctx.FileVersion > 5) { // new in save format 6 rowAnchorPattern = ctx.loadAnchorPattern(); enabledHandles = (Handles)reader.ReadInt64(); style = (TableStyle)reader.ReadInt32(); if (ctx.FileVersion > 7) { // new in file format 8 linkStyle = (TableLinkStyle)reader.ReadInt32(); if (ctx.FileVersion > 8) { // new in save format 9 anchorPattern = ctx.loadAnchorPattern(); // Load table arrows ctx.loadReference(this); ctx.loadReference(this); if (ctx.FileVersion > 13) { // new in save format 14 setExpanded(reader.ReadBoolean()); setExpandable(reader.ReadBoolean()); useStyledText = reader.ReadBoolean(); if (ctx.FileVersion > 18) { // new in save format 19 customDraw = (CustomDraw)reader.ReadInt32(); cellCustomDraw = (CustomDraw)reader.ReadInt32(); if (ctx.FileVersion > 21) { // new in save format 22 offsetHeaderRows = reader.ReadBoolean(); if (ctx.FileVersion > 24) { // new in save format 25 ctx.loadReference(this); // captionBackBrush } } } } } } } } resetCoveredCells(); updateText(); layoutText(); }
public virtual void loadFrom(BinaryReader reader, PersistContext ctx) { backColor = ctx.loadColor(); behavior = (BehaviorType)reader.ReadInt32(); arrowHead = (ArrowHead)reader.ReadInt32(); arrowBase = (ArrowHead)reader.ReadInt32(); arrowInterm = (ArrowHead)reader.ReadInt32(); arrowHeadSize = (float)reader.ReadDouble(); arrowBaseSize = (float)reader.ReadDouble(); arrowIntermSize = (float)reader.ReadDouble(); shadowsStyle = (ShadowsStyle)reader.ReadInt32(); boxFillColor = ctx.loadColor(); arrowFillColor = ctx.loadColor(); boxFrameColor = ctx.loadColor(); arrowColor = ctx.loadColor(); alignToGrid = reader.ReadBoolean(); showGrid = reader.ReadBoolean(); gridColor = ctx.loadColor(); gridSize = (float)reader.ReadDouble(); boxStyle = (BoxStyle)reader.ReadInt32(); shadowColor = ctx.loadColor(); imagePos = (ImageAlign)reader.ReadInt32(); textColor = ctx.loadColor(); activeMnpColor = ctx.loadColor(); selMnpColor = ctx.loadColor(); disabledMnpColor = ctx.loadColor(); arrowStyle = (ArrowStyle)reader.ReadInt32(); arrowSegments = reader.ReadInt16(); scrollX = (float)reader.ReadDouble(); scrollY = (float)reader.ReadDouble(); // zoomFactor was a short, now it is a float if (ctx.FileVersion < 19) zoomFactor = reader.ReadInt16(); else zoomFactor = reader.ReadSingle(); penDashStyle = (DashStyle)reader.ReadInt32(); penWidth = (float)reader.ReadDouble(); int c = reader.ReadInt32(); defPolyShape = reader.ReadBytes(c); docExtents = ctx.loadRectF(); shadowOffsetX = (float)reader.ReadDouble(); shadowOffsetY = (float)reader.ReadDouble(); tableFillColor = ctx.loadColor(); tableFrameColor = ctx.loadColor(); tableRowsCount = reader.ReadInt32(); tableColumnsCount = reader.ReadInt32(); tableColWidth = (float)reader.ReadDouble(); tableRowHeight = (float)reader.ReadDouble(); tableCaptionHeight = (float)reader.ReadDouble(); tableCaption = reader.ReadString(); arrowCascadeOrientation = (Orientation)reader.ReadInt32(); tableCellBorders = (CellFrameStyle)reader.ReadInt32(); boxIncmAnchor = (ArrowAnchor)reader.ReadInt32(); boxOutgAnchor = (ArrowAnchor)reader.ReadInt32(); boxesExpandable = reader.ReadBoolean(); tablesScrollable = reader.ReadBoolean(); }