Ejemplo n.º 1
0
        public DuctingControl()
        {
            InitializeComponent();

            // Assign defaults
            gridWidth             = 32;
            gridHeight            = 25;
            macroCols             = 2;
            macroRows             = 2;
            subCols               = 2;
            subRows               = 2;
            microCols             = 2;
            microRows             = 2;
            macroGridDefaultColor = System.Drawing.Color.LightGray;
            subGridDefaultColor   = System.Drawing.Color.LightGray;
            microGridDefaultColor = System.Drawing.Color.LightGray;
            blockDisplayType      = enGrid_BlockDisplayType.Address;
            visibleMacro          = true;
            visibleSub            = true;
            visibleMicro          = true;
            displayName           = false;
            displayAddress        = true;
            displayValue          = false;

            // Create first row
            _panelRow             = new GridControl_Row();
            _panelRow.Parent      = this;
            _panelRow.BorderStyle = BorderStyle.FixedSingle;
            _panelRow.Dock        = DockStyle.Fill;
            _panelRow.GridState   = null;
            _panelRow.Location    = new Point(3, 16);
            _panelRow.Name        = "R1";
            GenerateGrids();
        }
Ejemplo n.º 2
0
        /// <summary>Resume layout on all controls.</summary>
        private void Layout_Resume(GridControl_Row rootRow)
        {
            var gridControls = _gridControls.Values.ToList();

            foreach (IGridControl gridControl in gridControls)
            {
                gridControl.ResumeLayout(true);
            }
            Application.DoEvents();
            rootRow.Visible = true;
        }
Ejemplo n.º 3
0
        /// <summary>Creates the Grid control with macro, sub and micro grids.</summary>
        /// <param name="rootRow">The root row. This is the top most row</param>
        /// <param name="settings">The settings.</param>
        /// <param name="onClick">The on click.</param>
        /// <returns></returns>
        public GridControls_Create(GridControl_Row rootRow, GridControl_Settings settings, onGrid_Click onClick)        // Starting row
        {
            _Settings = settings;
            if (onClick != null)
            {
                _onClickEvent -= onClick;
                _onClickEvent += onClick;
            }

            // Setup cuboid row
            Layout_Reset(rootRow);
            Cuboid = new GridBlock_5Setup(onCreateGridControl, settings);
            Layout_Resume(rootRow);
        }
Ejemplo n.º 4
0
 /// <summary>Resets the grid control dictionary.</summary>
 /// <param name="rootRow">The root row.</param>
 private void Layout_Reset(GridControl_Row rootRow)
 {
     rootRow.SuspendLayout();
     rootRow.Visible = false;
     if (_gridControls.Count != 0)
     {
         // Remove all controls
         rootRow.Controls.Clear();
         _gridControls.Clear();
     }
     // Setup the root row
     _gridControls.Add(rootRow.Name, rootRow);
     rootRow.Height = _Settings.Size_CuboidHeight;
 }
Ejemplo n.º 5
0
        /// <summary>Try to find the specific grid control. If the control is not found it will be created.</summary>
        /// <param name="gridcontroltype">The gridcontroltype.</param>
        /// <param name="childname">The childname.</param>
        /// <param name="blocktype">The blocktype.</param>
        /// <param name="created">if set to <c>true</c> [created].</param>
        /// <returns></returns>
        private IGridControl GridControl_Get(enGrid_ControlType gridcontroltype, string childname, enGrid_BlockType blocktype, out bool created)
        {
            created = false;
            IGridControl gridControl;

            if (GridControl_Get(childname, out gridControl))
            {
                return(gridControl);                                              // The control was found -> work is done.
            }
            // We need to create the control
            if (gridcontroltype == enGrid_ControlType.Row)
            {
                #region Create a new row
                var row = new GridControl_Row();
                _gridControls.Add(childname, row);
                gridControl = row;
                #endregion
            }
            else
            {
                if (blocktype == enGrid_BlockType.MicroBlock)
                {
                    #region Create micro grid
                    var micro = new GridControl_BlockMicro();
                    _gridControls.Add(childname, micro);
                    gridControl = micro;
                    #endregion
                }
                else
                {
                    #region Create sub or macro grid block
                    var grid = new GridControl_Block();
                    _gridControls.Add(childname, grid);
                    gridControl = grid;
                    #endregion
                }
            }
            gridControl.Name = childname;   // Set the name
            gridControl.SuspendLayout();    // Optimise performance
            created = true;                 // Set flag
            return(gridControl);
        }
 /// <summary>
 /// Creates the child grids.
 /// </summary>
 /// <param name="grid">The grid.</param>
 /// <param name="rows">The rows.</param>
 /// <param name="cols">The cols.</param>
 public void CreateChildGrids(GridControl_Row rootRow, IGridControl grid, int rows, int cols)
 {
     Cuboid.CreateNewChildGrids(grid, onCreateGridControl, rows, cols);
     Layout_Resume(rootRow);
 }