Esempio n. 1
0
        private void DrawPagePoint(Graphics g)
        {
            if (ActiveSheet != null && ActiveSheet.ContainingViews.Length > 0)
            {
                SpreadView View = ActiveSheet.ContainingViews[0];
                Rectangle  Rect = View.GetViewportRectangle(0, 0);

                float LeftWidth = 0f;
                for (float i = PaperWidth; i < TotalWidth; i += PaperWidth)
                {
                    if (LeftColumn != 0)
                    {
                        LeftWidth = ColumnWidths[LeftColumn - 1];
                    }

                    float tmp = i - LeftWidth + Rect.Left;
                    if (tmp >= Rect.Left && tmp <= Rect.Right)
                    {
                        p1.X = tmp - 4f;
                        p1.Y = 0f;
                        p2.X = tmp + 4f;
                        p2.Y = 0f;
                        p3.X = tmp;
                        p3.Y = 9f;

                        Brush brush = new SolidBrush(Color.DarkGray);
                        g.FillPolygon(brush, new PointF[] { p1, p2, p3 }, System.Drawing.Drawing2D.FillMode.Alternate);
                        brush.Dispose();
                    }
                }

                float TopHeight = 0f;
                for (float i = PaperHeight; i < TotalHeight; i += PaperHeight)
                {
                    if (TopRow != 0)
                    {
                        TopHeight = RowHeights[TopRow - 1];
                    }

                    float tmp = i - TopHeight + Rect.Top;
                    if (tmp >= Rect.Top && tmp <= Rect.Bottom)
                    {
                        p1.X = 0f;
                        p1.Y = tmp - 4f;
                        p2.X = 0f;
                        p2.Y = tmp + 4f;
                        p3.X = 9f;
                        p3.Y = tmp;

                        Brush brush = new SolidBrush(Color.DarkGray);
                        g.FillPolygon(brush, new PointF[] { p1, p2, p3 }, System.Drawing.Drawing2D.FillMode.Alternate);
                        brush.Dispose();
                    }
                }
            }
        }
Esempio n. 2
0
        private void DrawPageLine(Graphics g)
        {
            try
            {
                if (ActiveSheet != null && ActiveSheet.ContainingViews.Length > 0)
                {
                    Pen pen = new Pen(SystemColors.ControlDarkDark, 2f);
                    pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;

                    SpreadView View = ActiveSheet.ContainingViews[0];
                    Rectangle  Rect = View.GetViewportRectangle(0, 0);

                    float temp      = 0f;
                    int   Count     = 0;
                    float LeftWidth = 0f;
                    for (int i = 0; i < ActiveSheet.ColumnHeader.Columns.Count; i++)
                    {
                        temp = temp + ActiveSheet.ColumnHeader.Columns[i].Width;
                        Count++;

                        if (temp - ActiveSheet.ColumnHeader.Columns[i].Width == PaperWidth)
                        {
                            float x = 0f;
                            if (Count > 1)
                            {
                                x = ColumnWidths[i] + Rect.Left - ActiveSheet.ColumnHeader.Columns[i].Width - 1;
                            }
                            else
                            {
                                x = ColumnWidths[i] + Rect.Left;
                            }

                            if (LeftColumn != 0)
                            {
                                LeftWidth = ColumnWidths[LeftColumn - 1];
                            }

                            float tmp = x - LeftWidth;
                            if (tmp >= Rect.Left && tmp <= Rect.Right)
                            {
                                g.DrawLine(pen, tmp, Rect.Top, tmp, this.Height - Rect.Top);
                            }

                            temp  = temp - PaperWidth;
                            Count = 0;
                        }
                    }

                    Count = 0;
                    temp  = 0f;
                    float TopHeight = 0f;
                    for (int i = 0; i < ActiveSheet.RowHeader.Rows.Count; i++)
                    {
                        temp = temp + ActiveSheet.RowHeader.Rows[i].Height;
                        Count++;

                        if (temp - ActiveSheet.RowHeader.Rows[i].Height == PaperHeight)
                        {
                            float y = 0f;
                            if (Count > 1)
                            {
                                y = RowHeights[i] + Rect.Top - ActiveSheet.RowHeader.Rows[i].Height - 1;
                            }
                            else
                            {
                                y = RowHeights[i] + Rect.Top;
                            }

                            if (TopRow != 0)
                            {
                                TopHeight = RowHeights[TopRow - 1];
                            }

                            float tmp = y - TopHeight;
                            if (tmp >= Rect.Top && tmp <= Rect.Bottom)
                            {
                                g.DrawLine(pen, Rect.Left, tmp, this.Width - Rect.Left, tmp);
                            }

                            temp  = temp - PaperHeight;
                            Count = 0;
                        }
                    }

                    pen.Dispose();
                }
            }
            catch
            {
            }
        }