Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SampleGridControl"/> class.
        /// </summary>
        public SampleGridControl()
        {
            GridStyleInfo footerStyle = Model.FooterStyle;

            footerStyle.Background = Brushes.Wheat;

            InitializeDataTable();
            SetupTimer();
            SourceList = this.table.DefaultView;

            RowHeights[10] = 40;
            RowHeights[15] = 60;

            BlinkTime = _blinkTime;

            this.Model.ColumnWidths[0] = 40;
            this.CurrentCell.Move(GridDirectionType.TopLeft, 1, false);
            this.Focus();
            this.Model.Options.AllowSelection = GridSelectionFlags.Cell;
        }
Esempio n. 2
0
		public void RefreshPropertyGrid()
		{
			{
				refreshPropertyGridNextIdle = false;
				if (style != null)
				{
					style.Changed -= new StyleChangedEventHandler(GridStyleInfoChanged);
				}
				
				grid = (GridControlBase) splitterControl1.ActivePane;
				style = grid.Model.GetCombinedStyle(range);
				if (style != null)
				{
					propertyGrid1.SelectedObject = style;
					style.Changed += new StyleChangedEventHandler(GridStyleInfoChanged);
				}
				else
					range = GridRangeInfo.Empty;
			}
		}
Esempio n. 3
0
        private void timer_Tick(object sender, EventArgs e)
        {
            gridControl1.BeginUpdate(BeginUpdateOptions.Invalidate);
            for (int rowIndex = 24; rowIndex < 36; rowIndex += 2)
            {
                GridStyleInfo       style         = gridControl1[rowIndex, 2];
                GridProgressBarInfo progressBarEx = style.ProgressBar;
                int pvalue = (progressBarEx.ProgressValue + rowIndex) % 100;
                progressBarEx.ProgressValue = pvalue;
            }

            GridStyleInfo       stylev         = gridControl1[26, 8];
            GridProgressBarInfo progressBarExv = stylev.ProgressBar;
            int pvaluev = (progressBarExv.ProgressValue + 3) % 100;

            progressBarExv.ProgressValue = pvaluev;

            gridControl1.EndUpdate(true);
            Application.DoEvents();
        }
Esempio n. 4
0
        /// <override/>
        protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds)
        {
            buttonsBounds[0] = GridUtil.CenterInRect(innerBounds, new Size(11, 11));
            //return innerBounds;


            buttonsBounds[0].X = innerBounds.X + leftSide;
            this.innerBounds   = innerBounds;

            if (rowIndex > this.Grid.Model.Rows.HeaderCount)
            {
                Node n = this.treeHelper.GetNode(rowIndex);

                int leftSideButton = buttonsBounds[0].X + n.Indent * offSet;

                buttonsBounds[0].X = this.Grid.IsRightToLeft()
                                                ? innerBounds.Right - leftSideButton + innerBounds.Left - buttonsBounds[0].Width
                                                : buttonsBounds[0].X = leftSideButton;
            }
            return(innerBounds);            //return rect;
        }
        protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds)
        {
            Rectangle rightArea;

            if (Grid.IsRightToLeft())
            {
                rightArea = Rectangle.FromLTRB(innerBounds.Left, innerBounds.Top, innerBounds.Left + 20,
                                               innerBounds.Bottom);
                innerBounds.X += 20;
            }
            else
            {
                rightArea = Rectangle.FromLTRB(innerBounds.Right - 20, innerBounds.Top, innerBounds.Right,
                                               innerBounds.Bottom);
            }

            innerBounds.Width -= 20;
            buttonsBounds[0]   = GridUtil.CenterInRect(rightArea, new Size(20, 20));

            return(innerBounds);
        }
Esempio n. 6
0
        public void ApplyStyle(GridStyleInfo style, GridRangeInfoList ranges)
        {
            GridCurrentCell cc = this.CurrentCell;

            foreach (GridRangeInfo range in ranges)
            {
                GridRangeInfo cellRange = range.ExpandRange(1, 1, Model.RowCount, Model.ColumnCount);
                int           row, col;
                if (cellRange.GetFirstCell(out row, out col))
                {
                    ModifyFontsAndOtherStyleProperties(style, Model[row, col]);

                    while (cellRange.GetNextCell(ref row, ref col))
                    {
                        ModifyFontsAndOtherStyleProperties(style, Model[row, col]);
                    }
                    Model.ResizeRowsToFit(range, GridResizeToFitOptions.NoShrinkSize);
                }
            }
            InvalidateCells();
        }
Esempio n. 7
0
            /// <summary>
            /// overriden to preapre the layout appearance of the cell.
            /// </summary>
            /// <param name="rowIndex">rowIndex of this cell in grid</param>
            /// <param name="colIndex">colIndex of this cell in grid</param>
            /// <param name="style">style information of the cell</param>
            /// <param name="innerBounds">inner text rectangle area</param>
            /// <param name="buttonsBounds">button bounds for the associated button in control</param>
            /// <returns></returns>
            protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds)
            {
                Rectangle buttonArea;
                int       buttonWidth = 18;

                bool isTextRightToLeft = (style.RightToLeft == RightToLeft.Inherit && Grid.IsRightToLeft()) || style.RightToLeft == RightToLeft.Yes;

                //Button area customization...........
                if (!isTextRightToLeft)
                {
                    buttonArea = Rectangle.FromLTRB(innerBounds.Location.X + sortIconSize, innerBounds.Location.Y, innerBounds.Right + buttonWidth + sortIconSize, innerBounds.Bottom);
                }
                else
                {
                    buttonArea = Rectangle.FromLTRB(innerBounds.Location.X, innerBounds.Location.Y, innerBounds.Left + buttonWidth, innerBounds.Bottom);
                }
                buttonsBounds[0] = GridUtil.CenterInRect(buttonArea, new Size(buttonWidth, 20));
                r1 = buttonArea;

                return(innerBounds);
            }
Esempio n. 8
0
        /// <summary>
        /// SelectionMarker sample Customizations
        /// </summary>
        private void SampleCustomization()
        {
            gridControl1.CommandStack.Enabled = true;
            gridControl1.CommandStack.UndoStack.Clear();
            gridControl1.ThemesEnabled = true;

            gridControl1.Selections.Add(GridRangeInfo.Cells(12, 3, 14, 7));
            gridControl1.CurrentCell.MoveTo(12, 3);


            oldSelections = new Queue();
            oldSelections.Enqueue(GridRangeInfo.Cells(12, 3, 14, 7));
            this.gridControl1.GridVisualStyles       = Syncfusion.Windows.Forms.GridVisualStyles.Metro;
            this.gridControl1.DefaultGridBorderStyle = GridBorderStyle.Solid;
            this.gridControl1.BackColor   = Color.White;
            this.gridControl1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            GridStyleInfo style = gridControl1.BaseStylesMap["Header"].StyleInfo;

            style.Font.Facename = "Segoe UI";
            this.StartPosition  = FormStartPosition.CenterScreen;
            this.ResumeLayout();
        }
Esempio n. 9
0
            /// <summary>
            /// overriden to invalidate the mousedown cellrange
            /// </summary>
            /// <param name="rowIndex">rowIndex of this cell in grid</param>
            /// <param name="colIndex">colIndex of this cell in grid</param>
            /// <param name="e">mouse event data</param>
            protected override void OnMouseDown(int rowIndex, int colIndex, MouseEventArgs e)
            {
                GridRangeInfo range = GridRangeInfo.Cell(rowIndex, colIndex);

                if (!range.IsEmpty)
                {
                    Grid.Model.GetSpannedRangeInfo(range.Top, range.Left, out this.mouseDownRange);
                    GridStyleInfo style = this.Grid.Model[range.Top, range.Left];
                    if (!style.Clickable || this.Grid.CellRenderers[style.CellType] != this)
                    {
                        this.mouseDownRange = GridRangeInfo.Empty;
                    }
                }

                this.mouseDown  = !mouseDownRange.IsEmpty;
                this.hoverRange = GridRangeInfo.Empty;
                if (this.mouseDown)
                {
                    this.inMouseDownRange = true;
                    this.Grid.InvalidateRange(this.mouseDownRange);
                }
                base.OnMouseDown(rowIndex, colIndex, e);
            }
Esempio n. 10
0
        /// <summary>
        /// Setting GridGrouping control Properties
        /// </summary>
        private void GridSettings()
        {
            this.gridControl1.RowCount = 40;
            this.gridControl1.ColCount = 20;

            for (int row = 1; row <= this.gridControl1.RowCount; ++row)
            {
                for (int i = 1; i <= this.gridControl1.ColCount; ++i)
                {
                    this.gridControl1[row, i].Text = (i * row) + 20.ToString();
                }
            }

            this.gridControl1.DefaultRowHeight         = (int)DpiAware.LogicalToDeviceUnits(18.0f);
            this.gridControl1.DefaultColWidth          = (int)DpiAware.LogicalToDeviceUnits(70.0f);
            this.gridControl1.GridVisualStyles         = GridVisualStyles.Metro;
            this.gridControl1.DefaultGridBorderStyle   = GridBorderStyle.Solid;
            this.gridControl1.Properties.GridLineColor = Color.FromArgb(208, 215, 229);
            GridStyleInfo style = gridControl1.BaseStylesMap["Header"].StyleInfo;

            style.Font.Facename = "Segoe UI";
            this.StartPosition  = FormStartPosition.CenterScreen;
        }
Esempio n. 11
0
        /// <summary>
        /// Inits the employee tree grid.
        /// </summary>
        /// <param name="grid">The grid.</param>
        private static void InitEmployeeTreeGrid(GridTreeControl grid)
        {
            //specify other miscellaneous properties
            grid.SupportRowSizing = true;
            grid.ShowRowHeader    = false;
            grid.ColumnHeaderStyle.HorizontalAlignment = HorizontalAlignment.Center;
            grid.ShowExpandColumnBorders = true;
            grid.AllowSort        = true;// false;
            grid.AllowDragColumns = true;
            Byte          k  = 150;
            Byte          k1 = 250;
            int           i  = -1;
            GridStyleInfo style;

            while (i < 6)
            {
                style = new GridStyleInfo();
                grid.LevelStyles.Add(style);
                k  += 15;
                k1 -= 15;
                i++;
            }
        }
Esempio n. 12
0
        /// <override/>
        protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds)
        {
            // Trace the properties of the cell
            TraceUtil.TraceCurrentMethodInfo(rowIndex, colIndex, style, innerBounds, buttonsBounds);
            Rectangle rightArea;

            if (this.Grid.IsRightToLeft())
            {
                rightArea      = Rectangle.FromLTRB(innerBounds.Left, innerBounds.Top, innerBounds.Left + 20, innerBounds.Bottom);
                innerBounds.X += 20;
            }
            else
            {
                // Here you specify where the button should be drawn within the cell.
                rightArea = Rectangle.FromLTRB(innerBounds.Right - 20, innerBounds.Top, innerBounds.Right, innerBounds.Bottom);
            }
            innerBounds.Width -= 20;
            buttonsBounds[0]   = GridUtil.CenterInRect(rightArea, new Size(20, 20));

            // Here you return the area where the text should be drawn/edited.

            return(innerBounds);
        }
Esempio n. 13
0
        public void ExecuteIndentCommand(int ActiveTabIndex, bool IsIncrement)
        {
            SampleGridControl ActiveGrid = ((Tab1.Items[ActiveTabIndex] as TabItem).Content as ScrollViewer).Content as SampleGridControl;

            if (!ActiveGrid.CurrentCell.HasCurrentCell)
            {
                return;
            }

            if (ActiveGrid != null && !ActiveGrid.Model.CurrentCellState.GridControl.CurrentCell.IsInMoveTo)
            {
                foreach (GridRangeInfo range in ActiveGrid.Model.SelectedRanges)
                {
                    for (int row = range.Top; row <= range.Bottom; row++)
                    {
                        for (int col = range.Left; col <= range.Right; col++)
                        {
                            GridStyleInfo cell = ActiveGrid.Model[row, col];
                            double        left = 0.0;
                            if (cell.HasTextMargins)
                            {
                                left = cell.TextMargins.Left;
                            }
                            if (IsIncrement)
                            {
                                cell.TextMargins = new CellMarginsInfo(left + 10, 0, 0, 0);
                            }
                            else if (left >= 10)
                            {
                                cell.TextMargins = new CellMarginsInfo(left - 10, 0, 0, 0);
                            }
                        }
                    }
                    ActiveGrid.Model.InvalidateCell(range);
                }
            }
        }
Esempio n. 14
0
        public MainWindow()
        {
            InitializeComponent();
            gridControl.Model.RowCount                = 40;
            gridControl.Model.ColumnCount             = 20;
            gridControl.Model.HeaderStyle.Borders.All = new Pen(Brushes.LightGray, 1);
            gridControl.Model.QueryCellInfo          += Model_QueryCellInfo;
            //Add nested grid to cell model
            gridControl.Model.CellModels.Add("ScrollGrid", scrollGridModel);
            gridControl.Model[2, 2].CellType = "ScrollGrid";



            GridModel nestedGrid = new GridModel();

            nestedGrid.Options.AllowSelection     = GridSelectionFlags.Cell;
            nestedGrid.RowHeights.DefaultLineSize = 20;
            nestedGrid.RowCount = 20;
            nestedGrid.ColumnWidths.DefaultLineSize = 50;
            nestedGrid.ColumnCount = 15;
            Brush headerBrush = ColorHelper.CreateFrozenSolidColorBrush(128, Colors.DarkGray);

            nestedGrid.BaseStylesMap["Header"].StyleInfo.Background = headerBrush;

            for (int i = 0; i < nestedGrid.RowCount; i++)
            {
                for (int j = 0; j < nestedGrid.ColumnCount; j++)
                {
                    GridStyleInfo style = new GridStyleInfo();
                    style.CellType        = "TextBox";
                    style.CellValue       = String.Format("{0}:{1}", i, j);
                    nestedGrid.Data[i, j] = style.Store;
                }
            }
            gridControl.Model[2, 2].CellValue = nestedGrid;
            gridControl.CoveredCells.Add(new Syncfusion.Windows.Controls.Cells.CoveredCellInfo(2, 2, 9, 5));
        }
        internal void OpenRedArrowIndicator()
        {
            if (!ShouldOpenArrow(false))
            {
                return;
            }
            redArrowOpend = true;

            Bitmap bm = CreateRedArrowIndicatorBitmap();

            redArrowIndicatorDragHelper = new DragFieldHelper();
            redArrowIndicatorDragHelper.StartDrag(bm, hiddenPoint, DragDropEffects.Move);
            // There is always a small black rectangle at the lower right-corner. Drawing
            // over the previously painted BackgroundImage resolves this issue.
            redArrowIndicatorDragHelper.DragWindow.Paint += new PaintEventHandler(DragWindow_Paint);
            if (!DragFieldMouseControllerBase.SupportsTransparentForm())
            {
                //GridRangeInfo rows = GetRangeOfColumnHeaderSection();
                int           rowIndex  = grid.Model.RowCount > 1 ? 2 : 0;//rows.Top;
                GridStyleInfo style     = grid.Model[rowIndex, 0];
                Color         backColor = Color.FromArgb(255, style.Interior.BackColor);
                redArrowIndicatorDragHelper.DragWindow.BackColor = backColor;
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Inits the employee tree grid.
        /// </summary>
        private void InitEmployeeTreeGrid()
        {
            //specify other miscellaneous properties
            this.AssociatedObject.SupportRowSizing = true;
            this.AssociatedObject.ShowRowHeader    = false;
            this.AssociatedObject.ColumnHeaderStyle.HorizontalAlignment = HorizontalAlignment.Center;
            this.AssociatedObject.ShowExpandColumnBorders = true;
            this.AssociatedObject.AllowSort        = true;// false;
            this.AssociatedObject.AllowDragColumns = true;
            Byte          k  = 150;
            Byte          k1 = 250;
            int           i  = -1;
            GridStyleInfo style;

            while (i < 6)
            {
                style            = new GridStyleInfo();
                style.Background = new SolidColorBrush(Color.FromArgb(255, 239, k1, k));
                this.AssociatedObject.LevelStyles.Add(style);
                k  += 15;
                k1 -= 15;
                i++;
            }
        }
Esempio n. 17
0
        private GridProgressBarInfo SetProgressBar(int row, int col)
        {
            GridStyleInfo style1 = this.gridDisplay[row, col];

            this.gridDisplay.CoveredRanges.Add(GridRangeInfo.Cells(row, col, row, col + 1));
            style1.BorderMargins.Left  = 30;
            style1.BorderMargins.Right = 20;

            GridProgressBarInfo progressBarEx1 = style1.ProgressBar;

            progressBarEx1.BeginUpdate();
            progressBarEx1.ProgressValue = 0;

            style1.CellType = "ProgressBar";
            style1.Themed   = false;
            //style1.CellAppearance = GridCellAppearance.Raised;

            progressBarEx1.BackGradientEndColor   = System.Drawing.SystemColors.ControlLightLight;
            progressBarEx1.BackGradientStartColor = System.Drawing.SystemColors.ControlDark;
            progressBarEx1.BackgroundStyle        = Syncfusion.Windows.Forms.Tools.ProgressBarBackgroundStyles.VerticalGradient;
            progressBarEx1.BackMultipleColors     = new System.Drawing.Color[] {
                System.Drawing.SystemColors.ControlDark,
                System.Drawing.SystemColors.ControlLightLight,
                System.Drawing.SystemColors.Control
            };

            progressBarEx1.ProgressStyle   = Syncfusion.Windows.Forms.Tools.ProgressBarStyles.Tube;
            progressBarEx1.SegmentWidth    = 10;
            progressBarEx1.StretchImage    = false;
            progressBarEx1.StretchMultGrad = false;
            progressBarEx1.TextShadow      = false;
            progressBarEx1.TubeEndColor    = System.Drawing.SystemColors.Control;
            progressBarEx1.TubeStartColor  = Color.Blue;//System.Drawing.SystemColors.ControlDark;
            progressBarEx1.EndUpdate();
            return(progressBarEx1);
        }
Esempio n. 18
0
        /// <summary>
        /// GridGrouping control getting started customization.
        /// </summary>
        private void GridSettings()
        {
            this.eventTracer1 = new ComboboxCells.EventTracer();


            //used to set multiextended selection mode in gridgrouping control.
            this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;

            // Header Text
            this.gridGroupingControl1.TableDescriptor.Columns["EmployeeID"].HeaderText                  = "Employee ID";
            this.gridGroupingControl1.TableDescriptor.Columns["LastName"].HeaderText                    = "Last Name";
            this.gridGroupingControl1.TableDescriptor.Columns["FirstName"].HeaderText                   = "First Name";
            this.gridGroupingControl1.TableDescriptor.Columns["TitleOfCourtesy"].HeaderText             = "Title Of Courtesy";
            this.gridGroupingControl1.TableDescriptor.Columns["BirthDate"].HeaderText                   = "Birth Date";
            this.gridGroupingControl1.TableDescriptor.Columns["HireDate"].HeaderText                    = "Hire Date";
            this.gridGroupingControl1.TableDescriptor.Columns["HomePhone"].HeaderText                   = "Home Phone";
            this.gridGroupingControl1.TableDescriptor.Columns["ReportsTo"].HeaderText                   = "Reports To";
            this.gridGroupingControl1.TableDescriptor.Columns["PostalCode"].HeaderText                  = "Postal Code";
            this.gridGroupingControl1.TableDescriptor.Columns["PhotoPath"].HeaderText                   = "Photo Path";
            this.gridGroupingControl1.TableDescriptor.Columns["SmallPhoto"].HeaderText                  = "Small Photo";
            this.gridGroupingControl1.GetTableDescriptor("Orders").Columns["ShipVia"].HeaderText        = "Ship Via";
            this.gridGroupingControl1.GetTableDescriptor("Orders").Columns["ShipRegion"].HeaderText     = "Ship Region";
            this.gridGroupingControl1.GetTableDescriptor("Orders").Columns["ShipPostalCode"].HeaderText = "Ship Postal Code";
            this.gridGroupingControl1.GetTableDescriptor("Orders").Columns["ShippedDate"].HeaderText    = "Shipped Date";
            this.gridGroupingControl1.GetTableDescriptor("Orders").Columns["ShipName"].HeaderText       = "Ship Name";
            this.gridGroupingControl1.GetTableDescriptor("Orders").Columns["ShipCountry"].HeaderText    = "Ship Country";
            this.gridGroupingControl1.GetTableDescriptor("Orders").Columns["ShipCity"].HeaderText       = "Ship City";
            this.gridGroupingControl1.GetTableDescriptor("Orders").Columns["ShipAddress"].HeaderText    = "Ship Address";
            this.gridGroupingControl1.GetTableDescriptor("Orders").Columns["RequiredDate"].HeaderText   = "Required Date";
            this.gridGroupingControl1.GetTableDescriptor("Orders").Columns["OrderID"].HeaderText        = "Order ID";
            this.gridGroupingControl1.GetTableDescriptor("Orders").Columns["OrderDate"].HeaderText      = "Order Date";

            this.gridGroupingControl1.ShowGroupDropArea           = true;
            this.gridGroupingControl1.TableOptions.GridLineBorder = new Syncfusion.Windows.Forms.Grid.GridBorder(GridBorderStyle.Solid, Color.FromArgb(208, 215, 229), GridBorderWeight.Thin);
            this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false;
            this.gridGroupingControl1.TopLevelGroupOptions.ShowCaption = false;
            eventTracer1.output.ControllerOptions = GridControllerOptions.All & (~GridControllerOptions.OleDataSource);

            eventTracer1.output.ResetVolatileData();
            eventTracer1.output.ColWidths[1]             = 200;
            eventTracer1.output.ColWidths[2]             = 1000;
            eventTracer1.output.GridVisualStyles         = GridVisualStyles.Metro;
            eventTracer1.output.DefaultGridBorderStyle   = GridBorderStyle.None;
            eventTracer1.output.Properties.GridLineColor = Color.FromArgb(208, 215, 229);
            GridStyleInfo style = eventTracer1.output.BaseStylesMap["Header"].StyleInfo;

            style.TextColor     = Color.MidnightBlue;
            style.Font.Facename = "Verdana";

            eventTracer1.output.RowHeights[0]        = 0;
            eventTracer1.output.ColWidths[0]         = 0;
            eventTracer1.output.RowCount             = 0;
            eventTracer1.output.ColCount             = 2;
            eventTracer1.output.ListBoxSelectionMode = SelectionMode.One;

            //used to set GridCaptionRowHeight.
            this.gridGroupingControl1.Table.DefaultCaptionRowHeight      = 25;
            this.gridGroupingControl1.Table.DefaultColumnHeaderRowHeight = 30;
            this.gridGroupingControl1.Table.DefaultRecordRowHeight       = 22;

            eventTracer1.output.QueryCellInfo                      += new GridQueryCellInfoEventHandler(Output_QueryCellInfo);
            eventTracer1.output.CurrentCellStartEditing            += new CancelEventHandler(Output_CurrentCellStartEditing);
            this.gridGroupingControl1.TableOptions.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro;

            //Navigate to other control using tabkey navigation
            this.gridGroupingControl1.WantTabKey = false;

            #region
            //
            // panel2
            //
            this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                                                                       | System.Windows.Forms.AnchorStyles.Right)));
            this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.panel2.Controls.Add(this.eventTracer1);
            this.panel2.Location = new System.Drawing.Point(1, 500);
            this.panel2.Name     = "panel2";
            this.panel2.Size     = new System.Drawing.Size(854, 148);
            this.panel2.TabIndex = 8;
            //
            // eventTracer1
            //
            this.eventTracer1.Dock      = System.Windows.Forms.DockStyle.Fill;
            this.eventTracer1.Enabled   = false;
            this.eventTracer1.Font      = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.eventTracer1.ForeColor = System.Drawing.Color.DimGray;
            this.eventTracer1.Location  = new System.Drawing.Point(0, 0);
            this.eventTracer1.Name      = "eventTracer1";
            this.eventTracer1.Size      = new System.Drawing.Size(852, 146);
            this.eventTracer1.TabIndex  = 12;
            tracer = new Tracer(this.gridGroupingControl1.Engine, eventTracer1);

            this.Controls.Add(this.panel2);
            #endregion
        }
Esempio n. 19
0
        /// <override/>
        protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style)
        {
            if (clientRectangle.IsEmpty)
            {
                return;
            }

            CustomGridControl grid = this.Grid as CustomGridControl;

            if (grid != null && grid.CenterTextInVisibleCellPart && colIndex < 3 && rowIndex > 0)
            {
                Rectangle bounds = clientRectangle;
                bounds.Intersect(grid.ViewLayout.RangeInfoToRectangle(GridRangeInfo.Cells(grid.TopRowIndex, 0, grid.ViewLayout.LastVisibleRow, grid.ViewLayout.LastVisibleCol), true, GridCellSizeKind.VisibleSize));
                bounds.Intersect(grid.ClientRectangle);

                string displayText = String.Empty;

                Rectangle textRectangle = RemoveMargins(bounds, style);
                if (textRectangle.IsEmpty)
                {
                    return;
                }

                displayText = style.Text;

                if (displayText.Length > 0)
                {
                    Font  font      = style.GdipFont;
                    Color textColor = Grid.PrintingMode && Grid.Model.Properties.BlackWhite ? Color.Black : style.TextColor;
                    DrawText(g, displayText, font, textRectangle, style, textColor, false);
                }
                return;
            }
            base.OnDraw(g, clientRectangle, rowIndex, colIndex, style);
        }
Esempio n. 20
0
        private void InitializeGrid()
        {
            #region Style declaration
            this.gridControl1.DefaultRowHeight = 18;
            GridStyleInfo headerstyle = new GridStyleInfo();
            headerstyle.Font.Size           = 12;
            headerstyle.Font.Bold           = true;
            headerstyle.TextColor           = Color.Black;
            headerstyle.VerticalAlignment   = GridVerticalAlignment.Middle;
            headerstyle.HorizontalAlignment = GridHorizontalAlignment.Center;
            headerstyle.CellType            = GridCellTypeName.Static;

            GridStyleInfo subheaderstyle = new GridStyleInfo();
            subheaderstyle.Font.Bold           = true;
            subheaderstyle.VerticalAlignment   = GridVerticalAlignment.Middle;
            subheaderstyle.HorizontalAlignment = GridHorizontalAlignment.Center;
            subheaderstyle.CellType            = GridCellTypeName.Static;

            GridStyleInfo valuestyle = new GridStyleInfo();
            valuestyle.BackColor           = SystemColors.Menu;
            valuestyle.TextColor           = Color.Black;
            valuestyle.VerticalAlignment   = GridVerticalAlignment.Middle;
            valuestyle.HorizontalAlignment = GridHorizontalAlignment.Center;

            gridControl1.FloatCellsMode          = GridFloatCellsMode.BeforeDisplayCalculation;
            gridControl1.Model.EnableLegacyStyle = true;
            int rowIndex = 1, colIndex = 2;
            #endregion

            #region ComboBoxCell (1 to 15)
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount));
            gridControl1[rowIndex, 1]      = headerstyle;
            gridControl1[rowIndex, 1].Text = "DropDown Cells";

            rowIndex += 3;

            ArrayList USStates = new ArrayList();
            USStates.Add(new USState("Alabama", "AL", 0));
            USStates.Add(new USState("Alaska", "AK", 1));
            USStates.Add(new USState("Arizona", "AZ", 2));
            USStates.Add(new USState("Arkansas", "AS", 3));
            USStates.Add(new USState("California", "CA", 4));
            USStates.Add(new USState("NewJersey", "NJ", 5));
            USStates.Add(new USState("Seattle", "ST", 6));

            gridControl1[rowIndex, colIndex].FloatCell = true;
            gridControl1.Model.ColWidths[5]            = 120;
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 3, rowIndex, 4));
            gridControl1[rowIndex, 3].Text          = "ComboBox Cells";
            gridControl1[rowIndex, 3].CellType      = GridCellTypeName.Static;
            gridControl1[rowIndex, 5].Text          = "Select your choice";
            gridControl1[rowIndex, 5].CellType      = GridCellTypeName.ComboBox;
            gridControl1[rowIndex, 5].DataSource    = USStates;
            gridControl1[rowIndex, 5].DisplayMember = "LongName";
            gridControl1[rowIndex, 5].ValueMember   = "ShortName";

            rowIndex++; rowIndex++;
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 3, rowIndex, 4));
            gridControl1[rowIndex, 3].Text          = "GridListControl Cells";
            gridControl1[rowIndex, 3].CellType      = GridCellTypeName.Static;
            gridControl1[rowIndex, 5].Text          = "Select your choice";
            gridControl1[rowIndex, 5].CellType      = GridCellTypeName.GridListControl;
            gridControl1[rowIndex, 5].DataSource    = USStates;
            gridControl1[rowIndex, 5].DisplayMember = "LongName";
            gridControl1[rowIndex, 5].ValueMember   = "ShortName";

            rowIndex++; rowIndex++;
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 3, rowIndex, 4));
            gridControl1[rowIndex, 3].Text     = "DropDown Grid Cells";
            gridControl1[rowIndex, 3].CellType = GridCellTypeName.Static;
            gridControl1[rowIndex, 5].CellType = GridCellTypeName.DropDownGrid;
            //gridControl1[rowIndex, 5].DataSource = USStates;
            //gridControl1[rowIndex, 5].DisplayMember = "LongName";
            //gridControl1[rowIndex, 5].ValueMember = "ShortName";
            rowIndex += 2;
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 3, rowIndex, 7));
            gridControl1[rowIndex, 3].CellType    = GridCellTypeName.CheckBox;
            gridControl1[rowIndex, 3].Description = "For themed scrollbars in DropDown";
            rowIndex++;
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 3, rowIndex + 3, 7));
            gridControl1[rowIndex, 3].CellType = GridCellTypeName.Static;
            gridControl1[rowIndex, 3].Text
                = "Dropdown can use the themed scrollbars only when. \n\n 1. LegacyStyles should be disabled which will applies the ColorStyles \n 2. \"EnableGridListControlInComboBox\" property should be enabled.";
            gridControl1[rowIndex, 3].FloatCell = true;

            for (int i = rowIndex; i <= rowIndex + 3; i++)
            {
                gridControl1.HideRows[i] = true;
            }

            rowIndex = 14;
            #endregion

            #region RadioButtons ( 16 to 18)
            rowIndex += 2;
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount));
            gridControl1[rowIndex, 1]      = headerstyle;
            gridControl1[rowIndex, 1].Text = "Radio Buttons";

            rowIndex += 2;
            StringCollection sc = new StringCollection();
            sc.AddRange(new String[] { "Button 0",
                                       "Disabled/disabled",
                                       "Button 2",
                                       "Button 3" });
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex, gridControl1.ColCount - 1));
            this.gridControl1[rowIndex, 1].ChoiceList        = sc;
            this.gridControl1[rowIndex, 1].CellType          = "RadioButton";
            this.gridControl1[rowIndex, 1].Font.Bold         = true;
            this.gridControl1[rowIndex, 1].CellValue         = 0;                  //selected button
            this.gridControl1[rowIndex, 1].TextAlign         = GridTextAlign.Left; //where descriptions are
            this.gridControl1[rowIndex, 1].TextMargins.Left  = 5;
            this.gridControl1[rowIndex, 1].TextMargins.Right = 5;
            #endregion

            #region PushButtons 20 to 23
            rowIndex += 2;
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount));
            gridControl1[rowIndex, 1]      = headerstyle;
            gridControl1[rowIndex, 1].Text = "Push Buttons";

            rowIndex += 3;
            gridControl1.RowHeights[rowIndex]                   = 22;
            gridControl1[rowIndex, colIndex].Description        = "Raised";
            gridControl1[rowIndex, colIndex].CellType           = GridCellTypeName.PushButton;
            gridControl1[rowIndex, colIndex].CellAppearance     = GridCellAppearance.Raised;
            gridControl1[rowIndex, colIndex].Font.Size          = 8;
            gridControl1[rowIndex, colIndex + 2].Description    = "Flat";
            gridControl1[rowIndex, colIndex + 2].CellType       = GridCellTypeName.PushButton;
            gridControl1[rowIndex, colIndex + 2].Font.Size      = 8;
            gridControl1[rowIndex, colIndex + 4].Description    = "Sunken";
            gridControl1[rowIndex, colIndex + 4].CellType       = GridCellTypeName.PushButton;
            gridControl1[rowIndex, colIndex + 4].Font.Size      = 8;
            gridControl1[rowIndex, colIndex + 4].CellAppearance = GridCellAppearance.Sunken;
            #endregion

            #region CheckBox cells
            rowIndex += 2;
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount));
            gridControl1[rowIndex, 1]      = headerstyle;
            gridControl1[rowIndex, 1].Text = "CheckBox Cells";

            rowIndex += 3;

            gridControl1.TableStyle.CheckBoxOptions                = new GridCheckBoxCellInfo("True", "False", "", false);
            gridControl1[rowIndex, colIndex].CellValue             = false;
            gridControl1[rowIndex, colIndex].Description           = "Click Me";
            gridControl1[rowIndex, colIndex].CellType              = "CheckBox";
            gridControl1[rowIndex, colIndex].TriState              = false;
            gridControl1[rowIndex, colIndex + 2].CellValue         = true;
            gridControl1[rowIndex, colIndex + 2].CellType          = "CheckBox";
            gridControl1[rowIndex, colIndex + 2].TriState          = true;
            gridControl1[rowIndex, colIndex + 2].Description       = "TriState";
            gridControl1[rowIndex, colIndex + 2].VerticalAlignment = GridVerticalAlignment.Middle;
            gridControl1[rowIndex, colIndex + 4].Text              = "True";
            gridControl1[rowIndex, colIndex + 4].CellType          = "CheckBox";
            gridControl1[rowIndex, colIndex + 4].TriState          = false;
            gridControl1[rowIndex, colIndex + 4].Description       = "Disabled";
            gridControl1[rowIndex, colIndex + 4].Enabled           = false;
            gridControl1[rowIndex, colIndex + 4].VerticalAlignment = GridVerticalAlignment.Bottom;
            #endregion

            #region Header cells
            rowIndex += 2;
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount));
            gridControl1[rowIndex, 1]      = headerstyle;
            gridControl1[rowIndex, 1].Text = "Header Cells";

            rowIndex += 3;

            gridControl1[rowIndex, colIndex].Text         = "Header";
            gridControl1[rowIndex, colIndex].CellType     = GridCellTypeName.Header;
            gridControl1[rowIndex, colIndex + 2].Text     = "Column Header";
            gridControl1[rowIndex, colIndex + 2].CellType = GridCellTypeName.Header;
            gridControl1[rowIndex, colIndex + 4].Text     = "Row Header";
            gridControl1[rowIndex, colIndex + 4].CellType = GridCellTypeName.Header;

            gridControl1.ColWidths[4] = 90;
            gridControl1.ColWidths[6] = 90;
            //gridControl1.ColWidths[8] = 90;
            #endregion
            this.textColorSettings(Color.Black);
        }
Esempio n. 21
0
 protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style)
 {
     style.Control = drawPictureBox;
     PictureBoxCellModel.InitializePictureBox(drawPictureBox, style);
     base.OnDraw(g, clientRectangle, rowIndex, colIndex, style);
 }
Esempio n. 22
0
        protected override Size OnQueryPrefferedClientSize(Graphics g, int rowIndex, int colIndex, GridStyleInfo style, GridQueryBounds queryBounds)
        {
            PictureBoxStyleProperties sp = new PictureBoxStyleProperties(style);
            Image img = sp.Image;

            if (img != null)
            {
                return(img.Size);
            }
            return(base.OnQueryPrefferedClientSize(g, rowIndex, colIndex, style, queryBounds));
        }
Esempio n. 23
0
 /// <summary>
 /// Initializes a PictureBoxStyleProperties object with a style object that holds all data
 /// </summary>
 public PictureBoxStyleProperties(GridStyleInfo style)
     : base(style)
 {
 }
Esempio n. 24
0
        /// <summary>
        /// Customizing Grid cells
        /// </summary>
        private void initializeGrid()
        {
            #region Style declaration
            this.gridControl1.DefaultRowHeight = 18;
            GridStyleInfo headerstyle = new GridStyleInfo();
            headerstyle.Font.Size           = 12;
            headerstyle.Font.Bold           = true;
            headerstyle.TextColor           = Color.Black;
            headerstyle.VerticalAlignment   = GridVerticalAlignment.Middle;
            headerstyle.HorizontalAlignment = GridHorizontalAlignment.Center;
            headerstyle.CellType            = GridCellTypeName.Static;

            GridStyleInfo subheaderstyle = new GridStyleInfo();
            subheaderstyle.Font.Bold           = true;
            subheaderstyle.VerticalAlignment   = GridVerticalAlignment.Middle;
            subheaderstyle.HorizontalAlignment = GridHorizontalAlignment.Center;
            subheaderstyle.CellType            = GridCellTypeName.Static;

            GridStyleInfo valuestyle = new GridStyleInfo();
            valuestyle.BackColor           = SystemColors.Menu;
            valuestyle.TextColor           = Color.Black;
            valuestyle.VerticalAlignment   = GridVerticalAlignment.Middle;
            valuestyle.HorizontalAlignment = GridHorizontalAlignment.Center;

            gridControl1.FloatCellsMode = GridFloatCellsMode.BeforeDisplayCalculation;
            int rowIndex = 1, colIndex = 2;
            #endregion

            #region Float Cells
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount));
            gridControl1[rowIndex, 1]      = headerstyle;
            gridControl1[rowIndex, 1].Text = "FloatingCells";

            rowIndex += 3;
            gridControl1[rowIndex, colIndex]      = valuestyle;
            gridControl1[rowIndex, colIndex].Text = "Control Overview";
            rowIndex++;
            gridControl1.Model.TextDataExchange.PasteTextFromBuffer(
                String.Concat(
                    "Public Properties\r\n",
                    "BackColor\tGets or sets the background color for the control. \r\n",
                    "Controls\tGets the collection of controls contained within the control. \r\n",
                    "Cursor\tGets or sets the cursor that is displayed when the mouse pointer is over the control. \r\n",
                    "DefaultBackColor\tGets the default background color of the control. \r\n",
                    "DefaultForeColor\tGets the default foreground color of the control. \r\n",
                    "Dock\tGets or sets which edge of the parent container a control is docked to. \r\n",
                    "Enabled\tGets or sets a value indicating whether the control can respond to user interaction. \r\n",
                    "Font\tGets or sets the font of the text displayed by the control. \r\n",
                    "ForeColor\tGets or sets the foreground color of the control. \r\n",
                    ""),
                GridRangeInfo.Cell(rowIndex, colIndex),
                int.MaxValue);
            gridControl1.ColWidths.ResizeToFit(GridRangeInfo.Cells(1, 1, gridControl1.RowCount, gridControl1.ColCount));
            #endregion

            #region CoveredCell
            rowIndex = 16;
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount));
            gridControl1[rowIndex, 1]      = headerstyle;
            gridControl1[rowIndex, 1].Text = "Covered Cells";

            rowIndex += 3;

            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, colIndex, rowIndex + 2, colIndex + 1));
            gridControl1[rowIndex, colIndex].BackColor           = Color.Orange;
            gridControl1[rowIndex, colIndex].Text                = "Covered in rows & cols";
            gridControl1[rowIndex, colIndex].TextColor           = Color.Black;
            gridControl1[rowIndex, colIndex].Font.Bold           = true;
            gridControl1[rowIndex, colIndex].VerticalAlignment   = GridVerticalAlignment.Middle;
            gridControl1[rowIndex, colIndex].HorizontalAlignment = GridHorizontalAlignment.Center;

            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, colIndex + 3, rowIndex, colIndex + 5));
            gridControl1[rowIndex, colIndex + 3].BackColor           = Color.Orange;
            gridControl1[rowIndex, colIndex + 3].Text                = "Covered in cols";
            gridControl1[rowIndex, colIndex + 3].TextColor           = Color.Black;
            gridControl1[rowIndex, colIndex + 3].Font.Bold           = true;
            gridControl1[rowIndex, colIndex + 3].VerticalAlignment   = GridVerticalAlignment.Middle;
            gridControl1[rowIndex, colIndex + 3].HorizontalAlignment = GridHorizontalAlignment.Center;

            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, colIndex + 7, rowIndex + 5, colIndex + 7));
            gridControl1[rowIndex, colIndex + 7].BackColor           = Color.Orange;
            gridControl1[rowIndex, colIndex + 7].Text                = "Cov. in rows";
            gridControl1[rowIndex, colIndex + 7].TextColor           = Color.Black;
            gridControl1[rowIndex, colIndex + 7].Font.Bold           = true;
            gridControl1[rowIndex, colIndex + 7].VerticalAlignment   = GridVerticalAlignment.Middle;
            gridControl1[rowIndex, colIndex + 7].HorizontalAlignment = GridHorizontalAlignment.Center;

            #endregion

            #region Banner Cells
            rowIndex = 26;
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount));
            gridControl1[rowIndex, 1]      = headerstyle;
            gridControl1[rowIndex, 1].Text = "Banner Cells";

            rowIndex += 3;

            GridStyleInfo style;
            style = gridControl1[rowIndex, colIndex];
            gridControl1.BanneredRanges.Add(GridRangeInfo.FromTlhw(rowIndex, colIndex, 8, colIndex + 1));
            style.BackgroundImage     = GetImage(@"cloud2.png");
            style.Text                = "cloud2.png";
            style.TextColor           = Color.Red;
            style.BackgroundImageMode = GridBackgroundImageMode.StretchImage;


            style = gridControl1[rowIndex, colIndex + 5];
            gridControl1.BanneredRanges.Add(GridRangeInfo.FromTlhw(rowIndex, colIndex + 5, 8, colIndex + 1));
            style.Interior  = new BrushInfo(GradientStyle.PathEllipse, SystemColors.Highlight, Color.White);
            style.Text      = "GradientStyle.PathEllipse";
            style.TextColor = Color.Blue;
            #endregion

            #region Custom Borders
            rowIndex = 39;
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount));
            gridControl1[rowIndex, 1]      = headerstyle;
            gridControl1[rowIndex, 1].Text = "Custom Borders Cells";

            gridControl1.DrawCellFrameAppearance += new GridDrawCellBackgroundEventHandler(gridControl1_DrawCellFrameAppearance);
            gridControl1.BeginUpdate();
            rowIndex += 3;
            rindex    = rowIndex; cindex = colIndex;
            for (int i = rowIndex; i <= rindex + 5; i++)
            {
                for (int j = colIndex; j <= cindex + 7; j++)
                {
                    GridStyleInfo newstyle = gridControl1[i, j];
                    newstyle.BorderMargins  = new GridMarginsInfo(5, 5, 5, 5);
                    newstyle.Borders.All    = GridBorder.Empty;
                    newstyle.CellAppearance = GridCellAppearance.Flat;
                }
            }
            gridControl1.EndUpdate(true);

            #endregion

            #region CustomDraw
            gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell;
            rowIndex = 49;
            gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(rowIndex, 1, rowIndex + 1, gridControl1.ColCount));
            gridControl1[rowIndex, 1]      = headerstyle;
            gridControl1[rowIndex, 1].Text = "Custom Drawing in  GridCells";
            //creating the datatable for the datasource
            DataTable dt = new DataTable();
            dt.Columns.Add("BookID");
            dt.Columns.Add("BookName");
            dt.Columns.Add("Author");
            dt.Columns.Add("Price");
            dt.Rows.Add(new object[] { "BookID", "BookName", "Author", "Price" });
            dt.Rows.Add(new object[] { "1001", "Computer Networks", "Tanenbaum", "75.00" });
            dt.Rows.Add(new object[] { "1002", "DBMS", "Navbathe", "85.00" });
            dt.Rows.Add(new object[] { "1003", "Let us C", "Leland Beck", "50.00" });
            dt.Rows.Add(new object[] { "1004", "System Software", "Hamacher", "78.00" });
            dt.Rows.Add(new object[] { "1005", "Computer Organization", "Carl", "50.00" });
            dt.Rows.Add(new object[] { "1006", "Test your c skills", "Ivan", "75.00" });
            dt.Rows.Add(new object[] { "1007", "C#.Net", "Alexis", "50.00" });
            dt.Rows.Add(new object[] { "1008", "Multimedia", "Leon", "75.00" });
            dt.AcceptChanges();

            rowIndex += 3;
            gridControl1[rowIndex, 6].Text = "Cart";
            gridControl1[rowIndex, 7].Text = "BookStatus";
            for (int i = rowIndex + 1; i <= 60; i++)
            {
                this.gridControl1[i, 6].CellValue = 0;
            }

            gridControl1.PopulateValues(GridRangeInfo.Cells(52, 2, 60, 5), dt);

            for (int k = 53; k <= 60; k++)
            {
                for (int l = 2; l <= 7; l++)
                {
                    //set the background of the cell
                    gridControl1[k, l].Interior = new BrushInfo(GradientStyle.ForwardDiagonal, Color.FromArgb(255, 187, 111), Color.White);
                }
            }


            for (int l = 2; l <= 7; l++)
            {
                //set the celltype as header
                gridControl1[52, l].CellType = GridCellTypeName.Header;
            }
            this.gridControl1.CellClick += new GridCellClickEventHandler(HandleAClick);
            //Handle the following events to do custom painting
            this.gridControl1.CellDrawn += new GridDrawCellEventHandler(gridControl1_CellDrawn);
            this.gridControl1.DrawCell  += new GridDrawCellEventHandler(gridControl1_DrawCell);
            #endregion
        }
Esempio n. 25
0
        //used to provide optimal height and width for cell (as in grid.ColWidths.ResizeToFit calls)
        protected override Size OnQueryPrefferedClientSize(Graphics g, int rowIndex, int colIndex, GridStyleInfo style, GridQueryBounds queryBounds)
        {
            Size sz = base.OnQueryPrefferedClientSize(g, rowIndex, colIndex, style, queryBounds);

            //adjust to allow for button width
            sz.Width = sz.Width + ButtonBarSize.Width;

            return(sz);
        }
        public void SortCol(int col, GridControl _grid)
        {
            if (_grid.CurrentCell.IsEditing)
                _grid.CurrentCell.EndEdit();

            GridStyleInfo style = new GridStyleInfo();
            style.Tag = "";

            //turn off the old sort arrow
            for (int col1 = 1; col1 <= _grid.ColCount; ++col1)
                if (col1 != col && _grid[0, col1].CellType == "ColumnHeaderCell")
                {
                    _grid[0, col1].CellType = "Header";
                    break;
                }

            //turn on new sort arrow
            _grid[0, col].CellType = "ColumnHeaderCell";

            ListSortDirection dir = ListSortDirection.Ascending;
            if (_grid[0, col].HasTag)
            {
                if ((ListSortDirection)_grid[0, col].Tag == ListSortDirection.Ascending)
                    dir = ListSortDirection.Descending;
            }

            _grid[0, col].Tag = dir;
            if (col == 4) //formulacell
            {
                //need to use custom comparer to get at the 
                //formula computed value instead of the formul itself.
                _grid.Data.SortByColumn(col, dir, new FormulaComparer());
            }
            else
            {
                _grid.Data.SortByColumn(col, dir);
            }
            GridFormulaEngine engine = ((GridFormulaCellModel)_grid.CellModels["FormulaCell"]).Engine;
            engine.RecalculateRange(GridRangeInfo.Col(4), true, true);
            _grid.Refresh();
        }
Esempio n. 27
0
 /// <summary>
 /// Initializes a ChartStyleProperties object with a style object that holds all data
 /// </summary>
 public ChartStyleProperties(GridStyleInfo style)
     : base(style)
 {
 }
Esempio n. 28
0
        protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style)
        {
            // Get the client bounds taking floated cells into consideration.
            Rectangle bounds = GetCellClientRectangle(rowIndex, colIndex, style, true);

            this.chartControl.Location  = bounds.Location;
            this.chartControl.BackColor = Color.FromArgb(255, Grid.GetBackColor(style.Interior.BackColor));
            //this.chartControl.Legend.Visible=true;

            GridChartCellModel model = this.Model as GridChartCellModel;

            model.InitializeChartProperties(this.chartControl, style);

            FixParent(this.chartControl);

            if (bmp == null)
            {
                bmp = new Bitmap(bounds.Width, bounds.Height);
            }

            chartControl.Draw(bmp);

            g.DrawImage(bmp, bounds);
        }
 protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style)
 {
     if (base.ShouldDrawFocused(rowIndex, colIndex))
     {
         style.Control = this.editРедакторСМаской;
     }
     else
     {
         style.Control = this.drawРедакторСМаской;
         едакторЯчеек_ТекстСМаской.ПроинициализироватьЗначение(this.drawРедакторСМаской, style.Description, style.CellValue);
         this.drawРедакторСМаской.BackColor = style.BackColor;
         this.drawРедакторСМаской.ForeColor = style.TextColor;
         this.drawРедакторСМаской.Enabled   = style.Enabled;
     }
     style.Control.BackColor = style.BackColor;
     base.OnDraw(g, clientRectangle, rowIndex, colIndex, style);
 }
Esempio n. 30
0
        private void SetGridProperties(GridControl gridControl)
        {
            gridControl.AllowDrop = true;
            gridControl.Model.Options.ExcelLikeSelectionFrame = true;
            Random r = new Random();

            gridControl.Model.RowCount        = 30;
            gridControl.Model.ColumnCount     = 25;
            gridControl.Model.RowHeights[1]   = 50;
            gridControl.Model.ColumnWidths[2] = 100;
            GridStyleInfo ci = new GridStyleInfo();

            for (int row = 1; row < 100; row++)
            {
                for (int col = 1; col <= 8; col++)
                {
                    if (col > 7)
                    {
                        continue;
                    }

                    if (r.Next(1, 4) == 2)
                    {
                        gridControl.Model[row, col].CellValue = r.Next(10, 100);
                    }
                    else if (r.Next(1, 4) == 3)
                    {
                        gridControl.Model[row, col].CellValue = "Text" + r.Next(10, 100).ToString();
                    }
                    else
                    {
                        gridControl.Model[row, col].CellValue = (r.Next(1000, 10000) * .01);
                    }

                    if (r.Next(10, 14) == 12)
                    {
                        gridControl.Model[row, col].Font.FontStyle  = FontStyles.Italic;
                        gridControl.Model[row, col].Font.FontWeight = FontWeights.Bold;
                        gridControl.Model[row, col].Font.FontSize   = 13;
                    }

                    if (r.Next(10, 14) == 13)
                    {
                        gridControl.Model[row, col].Background = Brushes.Orange;
                        gridControl.Model[row, col].Foreground = Brushes.Blue;
                    }

                    if (r.Next(10, 14) == 13)
                    {
                        gridControl.Model[row, col].HorizontalAlignment = HorizontalAlignment.Right;
                    }
                }
            }

            for (int row = 1; row <= gridControl.Model.RowCount; row++)
            {
                gridControl.Model[row, 7].CellType  = "DateTimeEdit";
                gridControl.Model[row, 7].CellValue = DateTime.Now;
            }

            gridControl.Model.CoveredCells.Add(new Syncfusion.Windows.Controls.Cells.CoveredCellInfo(4, 4, 6, 6));
            gridControl.Model.CoveredCells.Add(new Syncfusion.Windows.Controls.Cells.CoveredCellInfo(8, 10, 12, 12));
            gridControl.Model.ColumnWidths[7] = 100;
        }
        GridStyleInfo[] _GetSimpleBaseStyles(GridStyleInfo styleInfo, int rowIndex, int colIndex)
        {
            if (rowIndex < 0 || colIndex < 0)
            {
                return(null);
            }

            else if (rowIndex == 0 || colIndex == 0)
            {
                if (headerBaseStyles == null)
                {
                    int cellStyleCount = 0;

                    // Row, Column and Table style
                    cellStyleCount = 0;

                    // base style
                    string baseStyleName = "Header";

                    // load all parent base styles (including standard style)
                    int             level;
                    GridStyleInfo[] infoMapStyles = this.BaseStylesMap.GetBaseStylesMapStyles(baseStyleName, out level);

                    // combine the two arrays.
                    GridStyleInfo[] baseStyles = new GridStyleInfo[cellStyleCount + level];
                    if (infoMapStyles != null)
                    {
                        Array.Copy(infoMapStyles, 0, baseStyles, cellStyleCount, level);
                    }

                    // each GridStyleInfoIdentity will cache the baseStyles.
                    headerBaseStyles = baseStyles;
                }
                return(headerBaseStyles);
            }
            else
            {
                //return new GridStyleInfo[] { TableStyle };
                if (cachedBaseStyles == null)
                {
                    GridStyleInfo[] cellStyles = new GridStyleInfo[]
                    {
                        TableStyle
                    };
                    int cellStyleCount = 1;

                    GridStyleInfo item = styleInfo;
                    if (styleInfo == null)
                    {
                        item = this[rowIndex, colIndex];
                    }

                    string baseStyleName = "";
                    if (item.HasBaseStyle)
                    {
                        baseStyleName = item.BaseStyle;
                    }

                    // load standard style
                    int             level;
                    GridStyleInfo[] infoMapStyles = this.BaseStylesMap.GetBaseStylesMapStyles("Standard", out level);

                    // combine the two arrays.
                    GridStyleInfo[] baseStyles = new GridStyleInfo[cellStyleCount + level];
                    if (cellStyles != null)
                    {
                        Array.Copy(cellStyles, 0, baseStyles, 0, cellStyleCount);
                    }
                    if (infoMapStyles != null)
                    {
                        Array.Copy(infoMapStyles, 0, baseStyles, cellStyleCount, level);
                    }

                    // each GridStyleInfoIdentity will cache the baseStyles.
                    cachedBaseStyles = baseStyles;
                }
                return(cachedBaseStyles);
            }
        }
        public int Compare(object x, object y)
        {
            int c = 0;

            if (x == null && y == null)
            {
                //c = 0;
            }
            else if (x == null)
            {
                c = -1;
            }
            else if (y == null)
            {
                c = 1;
            }
            else
            {
                //the idea is to get at the FormulaTag object in the GridStyleInfoStore passed in
                //and use the FormulaTag.Text property to compare two cells.
                GridStyleInfo xStyle = new GridStyleInfo((GridStyleInfoStore)x);
                GridStyleInfo yStyle = new GridStyleInfo((GridStyleInfoStore)y);
                string xs = (xStyle.FormulaTag != null) ? xStyle.FormulaTag.Text : "";
                string ys = (yStyle.FormulaTag != null) ? yStyle.FormulaTag.Text : "";
                double xd = 0;
                double yd = 0;
                double.TryParse(xs, System.Globalization.NumberStyles.Any, null, out xd);
                double.TryParse(ys, System.Globalization.NumberStyles.Any, null, out yd);
                c = xd.CompareTo(yd);
            }
            return c;
        }