Пример #1
0
        public void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
        {
            if (commandStatus == HeaderSettingCommandStatus.SelectReportColumn)
            {
                Visible = true;
                if (fpSpreadForHeaderSetting.ReportColumnSelected != null && fpSpreadForHeaderSetting.ReportColumnSelected.IsNumber)
                {
                    Enabled = true;

                    for (int i = 0; i < toolStripMenuItems.Length; i++)
                    {
                        if (((ValueTranslateType)toolStripMenuItems[i].Tag) == fpSpreadForHeaderSetting.ReportColumnSelected.ValueTranslateType)
                        {
                            toolStripMenuItems[i].Checked = true;
                        }
                        else
                        {
                            toolStripMenuItems[i].Checked = false;
                        }
                    }
                }
                else
                {
                    Enabled = false;
                }
            }
            else
            {
                Visible = false;
            }
        }
Пример #2
0
        public virtual void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
        {
            if (commandStatus == HeaderSettingCommandStatus.SelectRow || commandStatus == HeaderSettingCommandStatus.SelectColumn || commandStatus == HeaderSettingCommandStatus.Null)
            {
                Enabled = false;
                Checked = false;
            }
            else
            {
                Enabled = true;

                int row         = fpSpreadForHeaderSetting.CellRange.Row;
                int column      = fpSpreadForHeaderSetting.CellRange.Column;
                int rowCount    = fpSpreadForHeaderSetting.CellRange.RowCount;
                int columnCount = fpSpreadForHeaderSetting.CellRange.ColumnCount;
                for (int i = row; i < row + rowCount; i++)
                {
                    for (int j = column; j < column + columnCount; j++)
                    {
                        CellHorizontalAlignment horizontalAlignment = fpSpreadForHeaderSetting.SheetMain.Cells[i, j].HorizontalAlignment;
                        if (HorizontalAlignment != horizontalAlignment)
                        {
                            goto End;
                        }
                    }
                }
                Checked = true;
                return;

End:
                Checked = false;
            }
        }
Пример #3
0
 public void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
 {
     if (commandStatus == HeaderSettingCommandStatus.SelectColumn)
     {
         Enabled = false;
     }
     else if (commandStatus == HeaderSettingCommandStatus.SelectRow)
     {
         Enabled = false;
     }
     else if (commandStatus == HeaderSettingCommandStatus.Null)
     {
         Enabled = false;
     }
     else if (commandStatus == HeaderSettingCommandStatus.SelectCell)
     {
         Enabled = true;
         int row    = fpSpreadForHeaderSetting.CellRange.Row;
         int column = fpSpreadForHeaderSetting.CellRange.Column;
         colorDialog.Color = fpSpreadForHeaderSetting.SheetMain.Cells[row, column].ForeColor;
     }
     else if (commandStatus == HeaderSettingCommandStatus.SelectReportColumn)
     {
         Enabled = true;
         if (fpSpreadForHeaderSetting.ReportColumnSelected != null)
         {
             colorDialog.Color = fpSpreadForHeaderSetting.ReportColumnSelected.GetHeaderColor();
         }
     }
 }
Пример #4
0
 public void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
 {
     if (commandStatus == HeaderSettingCommandStatus.SelectCell)
     {
         Visible = true;
         Enabled = true;
         int  row    = fpSpreadForHeaderSetting.CellRange.Row;
         int  column = fpSpreadForHeaderSetting.CellRange.Column;
         Cell cell   = fpSpreadForHeaderSetting.SheetMain.Cells[row, column];
         if (cell.RowSpan > 1 || cell.ColumnSpan > 1)
         {
             Checked = true;
         }
         else
         {
             Checked = false;
         }
     }
     else
     {
         Visible = true;
         Enabled = false;
         Checked = false;
     }
 }
Пример #5
0
        public void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
        {
            if (commandStatus == HeaderSettingCommandStatus.SelectReportColumn)
            {
                Visible = true;
                if (fpSpreadForHeaderSetting.ReportColumnSelected != null && fpSpreadForHeaderSetting.ReportColumnSelected.IsNumber)
                {
                    Enabled = true;

                    if (fpSpreadForHeaderSetting.ReportColumnSelected.RowTotalSum)
                    {
                        Checked = true;
                    }
                    else
                    {
                        Checked = false;
                    }
                }
                else
                {
                    Enabled = false;
                    Checked = false;
                }
            }
            else
            {
                Visible = false;
            }
        }
        public override void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
        {
            base.SetCommandStatus(commandStatus);
            if (commandStatus == HeaderSettingCommandStatus.SelectCell)
            {
                CellRange cellRange       = fpSpreadForHeaderSetting.CellRange;
                int       startCellRow    = cellRange.Row + cellRange.RowCount - 1;
                int       startCellColumn = cellRange.Column;
                for (int i = 0; i < cellRange.ColumnCount; i++)
                {
                    Cell       cell       = fpSpreadForHeaderSetting.SheetMain.Cells[startCellRow, startCellColumn + i];
                    LineBorder lineBorder = cell.Border as LineBorder;
                    if (lineBorder == null)
                    {
                        goto End;
                    }
                    else if (!lineBorder.Bottom)
                    {
                        goto End;
                    }
                }
                Checked = true;
                return;

End:
                Checked = false;
            }
        }
Пример #7
0
        public void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
        {
            if (commandStatus == HeaderSettingCommandStatus.SelectCell)
            {
                Visible = true;
                Enabled = true;
                CellRange cellRange       = fpSpreadForHeaderSetting.CellRange;
                int       startCellRow    = cellRange.Row;
                int       startCellColumn = cellRange.Column;

                //对于一个单独选中的Span过的Cell,RowCount与ColumnCount都为1。这会导致斜线计算错误,所以需要添加偏移量进行校正。
                int offset = 0;
                if (cellRange.RowCount == 1)
                {
                    Cell cell = fpSpreadForHeaderSetting.SheetMain.Cells[startCellRow, startCellColumn];
                    if (cell.RowSpan > 1)
                    {
                        offset = cell.RowSpan - 1;
                    }
                }
                int endCellRow = cellRange.Row + cellRange.RowCount - 1 + offset;

                offset = 0;
                if (cellRange.ColumnCount == 1)
                {
                    Cell cell = fpSpreadForHeaderSetting.SheetMain.Cells[startCellRow, startCellColumn];
                    if (cell.ColumnSpan > 1)
                    {
                        offset = cell.ColumnSpan - 1;
                    }
                }
                int endCellColumn = cellRange.Column + cellRange.ColumnCount - 1 + offset;

                Cell             startCell     = fpSpreadForHeaderSetting.SheetMain.Cells[startCellRow, startCellColumn];
                List <BevelLine> bevelLineList = fpSpreadForHeaderSetting.GetBevelLines();
                foreach (BevelLine bevelLine in bevelLineList)
                {
                    if (bevelLine.StartCellRow == startCellRow && bevelLine.StartCellColumn == startCellColumn)
                    {
                        if (bevelLine.EndCellRow == endCellRow && bevelLine.EndCellColumn == endCellColumn || cellRange.RowCount == 1 && cellRange.ColumnCount == 1 && bevelLine.EndCellRow == startCellRow + startCell.RowSpan - 1 && bevelLine.EndCellColumn == startCellColumn + startCell.ColumnSpan - 1)
                        {
                            if (bevelLine.BevelLineType == BevelLineType.Down)
                            {
                                Checked = true;
                                break;
                            }
                        }
                    }
                    Checked = false;
                }
            }
            else
            {
                Visible = true;
                Enabled = false;
                Checked = false;
            }
        }
 public void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
 {
     if (commandStatus != HeaderSettingCommandStatus.SelectReportColumn)
     {
         Visible = false;
     }
     else
     {
         Visible = true;
     }
 }
 public void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
 {
     if (commandStatus == HeaderSettingCommandStatus.SelectColumn)
     {
         Enabled = true;
     }
     else
     {
         Enabled = false;
     }
 }
Пример #10
0
 public virtual void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
 {
     if (commandStatus == HeaderSettingCommandStatus.SelectCell)
     {
         Enabled = true;
     }
     else
     {
         Enabled = false;
         Checked = false;
     }
 }
 public void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
 {
     if (commandStatus == HeaderSettingCommandStatus.SelectCell)
     {
         Visible = true;
         Enabled = true;
     }
     else
     {
         Visible = true;
         Enabled = false;
     }
 }
Пример #12
0
 private void fpMain_HeaderSettingCommandStatusChanged(object sender, HeaderSettingCommandStatus commandStatus)
 {
     //第一次接收Fp的编辑命令时,初始化按钮。
     if (toolStripItems == null)
     {
         InitToolStripItems();
     }
     //将Fp当前的编辑命令设置给按钮,让按钮处理Fp的命令。例如,当选中的是报表列时,设置Border的按钮都会变灰,就是这里起的作用。
     for (int i = 0; i < toolStripItems.Length; i++)
     {
         IHeaderSettingToolStripItem iHeaderSettingToolStripItem = toolStripItems[i] as IHeaderSettingToolStripItem;
         iHeaderSettingToolStripItem.SetCommandStatus(commandStatus);
     }
     //将已经处理Fp编辑命令的按钮发送到框架。
     if (ProvideToolStripMenu != null)
     {
         ProvideToolStripMenu(this, toolStripItems);
     }
 }
        protected override void OnSelectionChanged(FarPoint.Win.Spread.SelectionChangedEventArgs e)
        {
            int       reportColumnRowIndex = ReportColumnRowIndex;
            CellRange cellRange            = e.Range;

            //清空当前选择的报表列。
            reportColumnSelected = null;

            if (cellRange.IntersectRow(reportColumnRowIndex))
            {
                if (e.Range.Row >= 0 && e.Range.Column >= 0)
                {
                    if (sheetMain.ActiveRowIndex < reportColumnRowIndex)
                    {
                        sheetMain.AddSelection(cellRange.Row, cellRange.Column, cellRange.RowCount - 1, cellRange.ColumnCount);
                        cellRange = new CellRange(cellRange.Row, cellRange.Column, cellRange.RowCount - 1, cellRange.ColumnCount);
                    }
                    else if (sheetMain.ActiveRowIndex > reportColumnRowIndex)
                    {
                        sheetMain.AddSelection(cellRange.Row + 1, cellRange.Column, cellRange.RowCount - 1, cellRange.ColumnCount);
                        cellRange = new CellRange(cellRange.Row + 1, cellRange.Column, cellRange.RowCount - 1, cellRange.ColumnCount);
                    }
                }
            }
            HeaderSettingCommandStatus commandStatus;

            this.cellRange = cellRange;
            if (cellRange.Row < 0)
            {
                commandStatus = HeaderSettingCommandStatus.SelectColumn;
            }
            else if (cellRange.Column < 0)
            {
                commandStatus = HeaderSettingCommandStatus.SelectRow;
            }
            else if (cellRange.Row == reportColumnRowIndex)
            {
                reportColumnSelected = sheetMain.Cells[cellRange.Row, cellRange.Column].Tag as Column;
                if (reportColumnSelected != null)
                {
                    commandStatus = HeaderSettingCommandStatus.SelectReportColumn;
                }
                else
                {
                    commandStatus = HeaderSettingCommandStatus.Null;
                }
            }
            else
            {
                commandStatus = HeaderSettingCommandStatus.SelectCell;
            }

            this.commandStatus = commandStatus;
            ManualHeaderSettingCommandStatusChanged();

            if (this.commandStatus == HeaderSettingCommandStatus.SelectReportColumn)
            {
                if (canEditColumn && reportColumnSelected != null)
                {
                    if (reportColumnPropertyEditor == null)
                    {
                        reportColumnPropertyEditor = new ReportColumnPropertyEditor();
                        reportColumnPropertyEditor.HeaderSettingFpSpreadChanged += new HeaderSettingFpSpreadChangedHandle(reportColumnPropertyEditor_HeaderSettingFpSpreadChanged);
                        reportColumnPropertyEditor.Init();
                        Form parentForm = WindowManager.GetTopParentForm(this);
                        parentForm.AddOwnedForm(reportColumnPropertyEditor);
                        parentForm.SizeChanged     += new EventHandler(parentForm_SizeChanged);
                        parentForm.LocationChanged += new EventHandler(parentForm_LocationChanged);
                    }
                    #region 获得Fp在屏幕上的显示区域。
                    Rectangle screenRectangle = GetScreenRectangle();
                    //与屏幕区域求交集。
                    screenRectangle = Rectangle.Intersect(screenRectangle, Screen.PrimaryScreen.Bounds);
                    #endregion
                    #region 获得Cell在屏幕上的显示区域。
                    Rectangle cellScreenRectangle = GetCellScreenRectangle(cellRange.Row, cellRange.Column);
                    //与Fp区域求交集。
                    cellScreenRectangle = Rectangle.Intersect(cellScreenRectangle, screenRectangle);
                    #endregion
                    #region 去除RowHeader的宽。
                    int rowHeaderWidth = (int)sheetMain.RowHeader.Columns[0].Width;
                    screenRectangle = new Rectangle(screenRectangle.X + rowHeaderWidth, screenRectangle.Y, screenRectangle.Width - rowHeaderWidth, screenRectangle.Height);
                    #endregion
                    Point point = cellScreenRectangle.Location;
                    point.Offset(cellScreenRectangle.Size.Width / 2, cellScreenRectangle.Size.Height);
                    reportColumnPropertyEditor.ShowColumnProperty(reportColumnSelected, screenRectangle, point);
                }
            }
            else
            {
                HideReportColumnPropertyEditor();
            }
            base.OnSelectionChanged(e);
        }
 public void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
 {
 }
Пример #15
0
        public override void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
        {
            base.SetCommandStatus(commandStatus);
            if (commandStatus == HeaderSettingCommandStatus.SelectCell)
            {
                int        row         = fpSpreadForHeaderSetting.CellRange.Row;
                int        column      = fpSpreadForHeaderSetting.CellRange.Column;
                int        rowCount    = fpSpreadForHeaderSetting.CellRange.RowCount;
                int        columnCount = fpSpreadForHeaderSetting.CellRange.ColumnCount;
                LineBorder lineBorder;
                #region 测试中间部分与左侧。
                for (int i = row; i < row + rowCount - 1; i++)
                {
                    lineBorder = fpSpreadForHeaderSetting.SheetMain.Cells[i, column].Border as LineBorder;
                    if (lineBorder == null)
                    {
                        goto End;
                    }
                    else if (lineBorder.Left != lineBorderLeft.Left || lineBorder.Top != lineBorderLeft.Top || lineBorder.Right != lineBorderLeft.Right || lineBorder.Bottom != lineBorderLeft.Bottom)
                    {
                        goto End;
                    }

                    for (int j = column + 1; j < column + columnCount; j++)
                    {
                        lineBorder = fpSpreadForHeaderSetting.SheetMain.Cells[i, j].Border as LineBorder;
                        if (lineBorder == null)
                        {
                            goto End;
                        }
                        else if (lineBorder.Left != lineBorderCenter.Left || lineBorder.Top != lineBorderCenter.Top || lineBorder.Right != lineBorderCenter.Right || lineBorder.Bottom != lineBorderCenter.Bottom)
                        {
                            goto End;
                        }
                    }
                }
                #endregion
                #region 测试最下行。
                for (int i = column + 1; i < column + columnCount; i++)
                {
                    lineBorder = fpSpreadForHeaderSetting.SheetMain.Cells[row + rowCount - 1, i].Border as LineBorder;
                    if (lineBorder == null)
                    {
                        goto End;
                    }
                    else if (lineBorder.Left != lineBorderBottom.Left || lineBorder.Top != lineBorderBottom.Top || lineBorder.Right != lineBorderBottom.Right || lineBorder.Bottom != lineBorderBottom.Bottom)
                    {
                        goto End;
                    }
                }
                #endregion
                #region 测试最左行与最下行的交界处。
                lineBorder = fpSpreadForHeaderSetting.SheetMain.Cells[row + rowCount - 1, column].Border as LineBorder;
                if (lineBorder == null)
                {
                    goto End;
                }
                else if (lineBorder.Left != lineBorderCorner.Left || lineBorder.Top != lineBorderCorner.Top || lineBorder.Right != lineBorderCorner.Right || lineBorder.Bottom != lineBorderCorner.Bottom)
                {
                    goto End;
                }
                #endregion
                Checked = true;
                return;

End:
                Checked = false;
            }
        }
 void fpSpreadForHeaderSetting_HeaderSettingCommandStatusChanged(object sender, HeaderSettingCommandStatus commandStatus)
 {
     throw new Exception("The method or operation is not implemented.");
 }
 public void SetCommandStatus(HeaderSettingCommandStatus commandStatus)
 {
     Calculate();
 }