Example #1
0
        public void UpdateChart()
        {
            foreach (SheetView Sheet in FpSpread.Sheets)
            {
                //支持嵌入的图表
                int RowCount    = Sheet.GetLastNonEmptyRow(NonEmptyItemFlag.Style);
                int ColumnCount = Sheet.GetLastNonEmptyColumn(NonEmptyItemFlag.Style);
                for (int i = 0; i <= RowCount; i++)
                {
                    for (int j = 0; j <= ColumnCount; j++)
                    {
                        if (Sheet.Cells[i, j].CellType is ChartCellType)
                        {
                            ChartCellType ChartType = Sheet.Cells[i, j].CellType as ChartCellType;
                            Rectangle     r         = FpSpread.GetCellRectangle(0, 0, i, j);
                            ChartType.ChartSize   = r.Size;
                            ChartType.ActiveSheet = Sheet;
                            ChartType.UpdateChart();
                        }
                    }
                }

                //支持浮动的图表
                foreach (IElement Element in Sheet.DrawingContainer.ContainedObjects)
                {
                    if (Element is ChartShape)
                    {
                        ChartShape Shape = Element as ChartShape;
                        Shape.ActiveSheet = Sheet;
                        Shape.Locked      = false;
                        Shape.UpdateChart();
                    }
                }
            }
        }
Example #2
0
        private void Update(int Row, int Column)
        {
            int       RowViewportIndex    = FpSpread.GetActiveRowViewportIndex();
            int       ColumnViewportIndex = FpSpread.GetActiveColumnViewportIndex();
            Rectangle rect = FpSpread.GetCellRectangle(RowViewportIndex, ColumnViewportIndex, Row, Column);

            FpSpread.Invalidate(rect);
        }
Example #3
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            FpSpread  MyCell                = Parent as FpSpread;
            Rectangle RowHeaderRectangle    = MyCell.GetRowHeaderRectangle(0);
            Rectangle ColumnHeaderRectangle = MyCell.GetColumnHeaderRectangle(0);
            Point     point = new Point(this.Left + RowHeaderRectangle.Width, this.Top + ColumnHeaderRectangle.Height);
            CellRange range = MyCell.GetCellFromPixel(0, 0, point.X, point.Y);
            Rectangle r     = MyCell.GetCellRectangle(0, 0, range.Row, range.Column);

            setRow(range.Row);
            setColumn(range.Column);
            setLeftDistance(point.X - r.Left);
            setTopDistance(point.Y - r.Top);

            base.OnMouseMove(e);
        }