示例#1
0
        private FarPoint.Win.Spread.FpSpread GenFpSpread(Control parent)
        {
            FarPoint.Win.Spread.FpSpread  _spread = new FarPoint.Win.Spread.FpSpread();
            FarPoint.Win.Spread.SheetView _sheet  = new FarPoint.Win.Spread.SheetView();

            //_spread.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            //            | System.Windows.Forms.AnchorStyles.Left)
            //            | System.Windows.Forms.AnchorStyles.Right)));
            _spread.BackColor = System.Drawing.SystemColors.Control;
            _spread.HorizontalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded;
            _spread.Location    = new System.Drawing.Point(0, 2);
            _spread.RightToLeft = System.Windows.Forms.RightToLeft.No;
            _spread.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] { _sheet });
            _spread.Dock = DockStyle.Fill;

            FarPoint.Win.Spread.TipAppearance _tipAppearance = new FarPoint.Win.Spread.TipAppearance();
            _tipAppearance.BackColor        = System.Drawing.SystemColors.Info;
            _tipAppearance.Font             = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            _tipAppearance.ForeColor        = System.Drawing.SystemColors.InfoText;
            _spread.TextTipAppearance       = _tipAppearance;
            _spread.VerticalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded;

            _sheet.Reset();
            _sheet.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1;
            _sheet.ColumnCount    = 3;
            _sheet.RowCount       = 2;
            _sheet.ColumnHeader.Cells.Get(0, 0).Value = "资源代码";
            _sheet.ColumnHeader.Cells.Get(0, 1).Value = "资源名称";
            _sheet.ColumnHeader.Cells.Get(0, 2).Value = "备注";
            _sheet.Columns.Get(0).Label = "资源代码";
            _sheet.Columns.Get(0).Width = 127F;
            _sheet.Columns.Get(1).Label = "资源名称";
            _sheet.Columns.Get(1).Width = 203F;
            _sheet.Columns.Get(2).Label = "备注";
            _sheet.Columns.Get(2).Width = 212F;
            _sheet.GrayAreaBackColor    = System.Drawing.SystemColors.Window;
            _sheet.OperationMode        = FarPoint.Win.Spread.OperationMode.SingleSelect;
            _sheet.RowHeader.Columns.Default.Resizable = false;
            _sheet.RowHeader.Visible = false;
            _sheet.SelectionPolicy   = FarPoint.Win.Spread.Model.SelectionPolicy.Single;
            _sheet.SelectionUnit     = FarPoint.Win.Spread.Model.SelectionUnit.Row;
            _sheet.ReferenceStyle    = FarPoint.Win.Spread.Model.ReferenceStyle.A1;

            return(_spread);
        }
        private void InitializeBTabControl()
        {
            for (int i = 0; i < this._sSelectedContextKeys.Count; i++)
            {
                TabPage tabPage = new TabPage(this._sSelectedContextKeys[i].ToString());
                BSpread bSpread = new BSpread();
                FarPoint.Win.Spread.SheetView bSpread_Sheet1 = new FarPoint.Win.Spread.SheetView();

                bSpread_Sheet1.Reset();
                bSpread_Sheet1.SheetName = "Sheet1";

                bSpread.About = "3.0.2005.2005";
                bSpread.AccessibleDescription = "";
                bSpread.AllowNewRow           = true;
                bSpread.AutoClipboard         = false;
                bSpread.AutoGenerateColumns   = false;
                bSpread.BssClass             = "";
                bSpread.ClickPos             = new System.Drawing.Point(0, 0);
                bSpread.ColFronzen           = 0;
                bSpread.ComboEnable          = true;
                bSpread.DataAutoHeadings     = false;
                bSpread.DataSet              = null;
                bSpread.DateToDateTimeFormat = false;
                bSpread.DefaultDeleteValue   = true;
                bSpread.DisplayColumnHeader  = true;
                bSpread.DisplayRowHeader     = true;
                bSpread.Dock                      = System.Windows.Forms.DockStyle.Fill;
                bSpread.EditModeReplace           = true;
                bSpread.FilterVisible             = false;
                bSpread.HeadHeight                = 20F;
                bSpread.HorizontalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded;
                bSpread.IsCellCopy                = false;
                bSpread.IsMultiLanguage           = false;
                bSpread.IsReport                  = false;
                bSpread.Key           = "";
                bSpread.Location      = new System.Drawing.Point(3, 3);
                bSpread.Name          = "bSpread";
                bSpread.RowFronzen    = 0;
                bSpread.RowInsertType = BISTel.PeakPerformance.Client.BISTelControl.InsertType.Current;
                bSpread.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] { bSpread_Sheet1 });
                bSpread.Size                    = new System.Drawing.Size(550, 283);
                bSpread.StyleID                 = null;
                bSpread.TabIndex                = 0;
                bSpread.UseAutoSort             = false;
                bSpread.UseCheckAll             = false;
                bSpread.UseCommandIcon          = false;
                bSpread.UseFilter               = false;
                bSpread.UseGeneralContextMenu   = false;
                bSpread.UseHeadColor            = false;
                bSpread.UseOriginalEvent        = false;
                bSpread.UseSpreadEdit           = true;
                bSpread.UseWidthMemory          = true;
                bSpread.VerticalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded;
                bSpread.WhenDeleteUseModify     = false;

                bSpread.ClearHead();
                bSpread.AddHeadComplete();
                bSpread.UseFilter           = false;
                bSpread.FilterVisible       = true;
                bSpread.UseSpreadEdit       = false;
                bSpread.AutoGenerateColumns = false;
                bSpread.IsMultiLanguage     = false;
                this.InitializeBSpread(ref bSpread, this._sSelectedContextKeys[i].ToString());
                bSpread.ButtonClicked += new FarPoint.Win.Spread.EditorNotifyEventHandler(bSpread_ButtonClicked);
                bSpread.Dock           = DockStyle.Fill;


                tabPage.Controls.Add(bSpread);

                this.bTabControl1.Controls.Add(tabPage);
            }
        }
示例#3
0
        private void InitializeBSpreadContxt(string sName, DataTable _dt)
        {
            bool bDesc = false;

            bSpreadContext_Sheet1 = new FarPoint.Win.Spread.SheetView();
            bSpreadContext_Sheet1.Reset();
            bSpreadContext_Sheet1.SheetName = "Sheet1";

            bSpreadContext      = new BSpread();
            bSpreadContext.Name = "bSpreadContext_" + sName;
            bSpreadContext.Sheets.AddRange(new FarPoint.Win.Spread.SheetView[] { bSpreadContext_Sheet1 });
            bSpreadContext.UseSpreadEdit       = false;
            bSpreadContext.AutoGenerateColumns = false;
            bSpreadContext.ActiveSheet.DefaultStyle.ResetLocked();
            bSpreadContext.UseEdit = true;
            bSpreadContext.ClearHead();
            bSpreadContext.Locked                    = true;
            bSpreadContext.UseHeadColor              = true;
            bSpreadContext.EditMode                  = false;
            bSpreadContext.ActiveSheet.RowCount      = 0;
            bSpreadContext.ActiveSheet.ColumnCount   = 0;
            bSpreadContext.VerticalScrollBarPolicy   = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded;
            bSpreadContext.HorizontalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded;
            bSpreadContext.ButtonClicked            += new FarPoint.Win.Spread.EditorNotifyEventHandler(bSpreadContext_ButtonClicked);

            bSpreadContext.DataSource = null;
            bSpreadContext.ClearHead();

            //SPC-777 Louis ContextMenu 삭제;
            bSpreadContext.UseGeneralContextMenu = false;

            //if (sName == Definition.CHART_COLUMN.OPERATION_ID || sName == Definition.CHART_COLUMN.MEASURE_OPERATION_ID) bDesc = true;

            //if (bDesc)
            //{
            //    bSpreadContext.ActiveSheet.ColumnCount = 3;
            //    bSpreadContext.Width = 300;
            //}
            //else
            //{
            //    bSpreadContext.ActiveSheet.ColumnCount = 2;
            //    bSpreadContext.Width = 180;
            //}

            bSpreadContext.AddHead((int)SPCChartConditionContext.SELECT, this._mlthandler.GetVariable(Definition.SpreadHeaderColKey.V_SELECT), COLUMN.SELECT, 40, 20, null, null, null, ColumnAttribute.Null, ColumnType.CheckBox, null, null, null, false, true);
            bSpreadContext.AddHead(1, sName, COLUMN.CONTEXT_VALUE, 80, 20, null, null, null, ColumnAttribute.Null, ColumnType.String, null, null, null, false, true);

            if (bDesc)
            {
                bSpreadContext.AddHead(2, COLUMN.DESCRIPTION, COLUMN.DESCRIPTION, 120, 20, null, null, null, ColumnAttribute.Null, ColumnType.String, null, null, null, false, true);
            }

            bSpreadContext.DataSource = _dt;

            this.bSpreadContext.Width = 40;

            for (int i = 0; i < bSpreadContext.ActiveSheet.Columns.Count; i++)
            {
                float _fSpreadWidth = bSpreadContext.ActiveSheet.Columns[i].GetPreferredWidth();
                this.bSpreadContext.ActiveSheet.Columns[i].Width = _fSpreadWidth;
                this.bSpreadContext.Width += (int)_fSpreadWidth;
            }
        }