Esempio n. 1
1
        private void Form1_Load(object sender, System.EventArgs e)
        {
            grid1.Redim(10, 5);
            grid1.SelectionMode = SourceGrid.GridSelectionMode.Row;

            //Setup the controllers
            CellClickEvent clickController  = new CellClickEvent();
            PopupMenu      menuController   = new PopupMenu();
            CellCursor     cursorController = new CellCursor();

            SourceGrid.Cells.Controllers.ToolTipText toolTipController = new SourceGrid.Cells.Controllers.ToolTipText();
            toolTipController.ToolTipTitle = "ToolTip example";
            toolTipController.ToolTipIcon  = ToolTipIcon.Info;
            toolTipController.IsBalloon    = true;
            ValueChangedEvent valueChangedController = new ValueChangedEvent();

            for (int r = 0; r < grid1.Rows.Count; r++)
            {
                if (r == 0)
                {
                    grid1[r, 0] = new SourceGrid.Cells.ColumnHeader("Click event");
                    grid1[r, 1] = new SourceGrid.Cells.ColumnHeader("Custom Cursor");
                    grid1[r, 2] = new SourceGrid.Cells.ColumnHeader("ContextMenu");
                    grid1[r, 3] = new SourceGrid.Cells.ColumnHeader("ToolTip");
                    grid1[r, 4] = new SourceGrid.Cells.ColumnHeader("ValueChanged");
                }
                else
                {
                    grid1[r, 0]             = new SourceGrid.Cells.Cell("Value " + r.ToString(), typeof(string));
                    grid1[r, 1]             = new SourceGrid.Cells.Cell(DateTime.Now, typeof(DateTime));
                    grid1[r, 2]             = new SourceGrid.Cells.Cell("Right click");
                    grid1[r, 3]             = new SourceGrid.Cells.Cell("Value " + r.ToString());
                    grid1[r, 3].ToolTipText = "Example of tooltip, bla bla bla ....\n Row: " + r.ToString();
                    grid1[r, 4]             = new SourceGrid.Cells.Cell("Value " + r.ToString(), typeof(string));
                }

                grid1[r, 0].AddController(clickController);
                grid1[r, 1].AddController(cursorController);
                grid1[r, 2].AddController(menuController);
                grid1[r, 3].AddController(toolTipController);
                grid1[r, 4].AddController(valueChangedController);
            }

            grid1.AutoSizeCells();

            //Add the key controller to all the cells
            grid1.Controller.AddController(new KeyEvent(this));
        }
Esempio n. 2
0
        private void InitializeGrid(object sender, System.EventArgs e)
        {
            grid1.BorderStyle  = BorderStyle.FixedSingle;
            grid1.ColumnsCount = 3;

            // create header
            grid1.Rows.Insert(0);
            grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("RichTextBox");
            grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("RichTextBox");
            grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("RichTextBox");

            // create 10 rows
            for (Int32 r = 1; r < 10; r++)
            {
                grid1.Rows.Insert(r);

                // create three columns
                for (Int32 c = 0; c < 3; c++)
                {
                    // create richTextBox
                    SourceGrid.Cells.RichTextBox         richTextBox     = CreateRichTextBox();
                    SourceGrid.Cells.Views.RichTextBox   richTextBoxView = CreateRichTextBoxView();
                    SourceGrid.Cells.Editors.RichTextBox editor          = new SourceGrid.Cells.Editors.RichTextBox();
                    editor.Control.Multiline = true;
                    grid1[r, c]        = richTextBox;
                    grid1[r, c].Editor = editor;
                    grid1[r, c].View   = richTextBoxView;
                }
            }

            grid1.AutoSizeCells();
        }
Esempio n. 3
0
        private void frmSample54_Load(object sender, System.EventArgs e)
        {
            grid1.BorderStyle = BorderStyle.FixedSingle;

            grid1.ColumnsCount = 4;
            grid1.FixedRows    = 1;
            grid1.Rows.Insert(0);
            grid1.Selection.FocusStyle = FocusStyle.None;

            cbEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(string));
            cbEditor.StandardValues = new string[] { "Value 1", "Value 2", "Value 3" };
            cbEditor.EditableMode   = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.SingleClick | SourceGrid.EditableMode.AnyKey;

            grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String");
            grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime");
            grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox");
            grid1[0, 3] = new SourceGrid.Cells.ColumnHeader("ComboBox");
            for (int r = 1; r < 10; r++)
            {
                grid1.Rows.Insert(r);
                PopulateRow(r);
            }

            grid1.AutoSizeCells();

            numericUpDownRowIndex.Value   = 0;
            numericUpDownRowIndex.Minimum = 1;
            numericUpDownRowIndex.Value   = 3;
            buttonEditCell.Click         += delegate { StartEdit(grid1.Selection.ActivePosition); };
        }
Esempio n. 4
0
		public void Bug_3424()
		{
			var grid1 = new Grid();
			grid1.ColumnsCount = 3;
			grid1.FixedRows = 1;
			grid1.Rows.Insert(0);
	
			SourceGrid.Cells.ColumnHeader header1 = new SourceGrid.Cells.ColumnHeader("String");
	
			// here you can se the other column to sort when the current column is equal
			header1.SortComparer = new SourceGrid.MultiColumnsComparer(1, 2);
	
			var sorter = new SourceGrid.Cells.ColumnHeader("CheckBox");
			grid1[0, 0] = header1;
			grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime");
			grid1[0, 2] = sorter;
			for (int r = 1; r < 10; r++)
			{
				grid1.Rows.Insert(r);
				grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string));
				grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today.AddDays(7 * r), typeof(DateTime));
				grid1[r, 2] = new SourceGrid.Cells.CheckBox("", true);
			}
			
			grid1[9, 2] = null;
			grid1[9, 1].ColumnSpan = 2;
			
			sorter.Sort(true);
		}
Esempio n. 5
0
 public void DoFullTab4_frez()
 {
     #region SQLite Connection
     sqlite_conn = new SQLiteConnection("Data Source=databaseF.sqlite;Version=3;New=True;Compress=True;"); // create a new databaseF connection
     sqlite_conn.Open();                                                                                   // open the connection:
     sqlite_cmd             = sqlite_conn.CreateCommand();                                                 // create a new SQL command
     sqlite_cmd.CommandText = "SELECT * FROM FrParamKp";                                                   // First lets build a SQL-Query again
     sqlite_datareader      = sqlite_cmd.ExecuteReader();                                                  // The SQLiteDataReader allows us to run through the result lines
     #endregion
     #region Код таблицы 4 (Коэф. Kp)
     grid4Frez.BorderStyle = BorderStyle.FixedSingle;
     grid4Frez.Redim(3, 2);
     grid4Frez[0, 0] = new SourceGrid.Cells.ColumnHeader("Обрабатываемый \nматериал");
     grid4Frez[0, 1] = new SourceGrid.Cells.ColumnHeader("Коэффицент Kp");
     for (int r = 1; r < 3; r++)
     {
         if (sqlite_datareader.Read())
         {
             grid4Frez[r, 0] = new SourceGrid.Cells.RowHeader(Convert.ToString(sqlite_datareader.GetString(0)));
             grid4Frez[r, 1] = new SourceGrid.Cells.Cell(Convert.ToSingle(sqlite_datareader.GetString(1)), typeof(float));
             grid4Frez[r, 0].View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
         }
         grid4Frez[r, 1].View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
         grid4Frez[r, 1].AddController(clickEvent);              //клик мыши
         grid4Frez[r, 1].AddController(cellpointer);             //наведение
         grid4Frez[r, 1].Editor.EnableEdit = false;              //нередактируемые ячейки
         grid4Frez[r, 1].AddController(new SourceGrid.Cells.Controllers.Unselectable());
         grid4Frez[r, 1].AddController(new MyHelpRowTracking()); //help row pointer
     }
     grid4Frez.AutoSizeCells();
     grid4Frez.EnableSort = false;
     grid4Frez.Selection.EnableMultiSelection = false;
     sqlite_conn.Close();
     #endregion
 }
Esempio n. 6
0
        private void frmSample45_Load(object sender, EventArgs e)
        {
            grid1.BorderStyle = BorderStyle.FixedSingle;

            grid1.ColumnsCount = 3;
            grid1.FixedRows    = 1;
            grid1.Rows.Insert(0);
            grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String");
            grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime");
            grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox");
            for (int r = 1; r < 10; r++)
            {
                grid1.Rows.Insert(r);
                grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string));
                grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime));
                grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true);
            }

            grid1.AutoSizeCells();

            grid1.Selection.FocusStyle = grid1.Selection.FocusStyle | SourceGrid.FocusStyle.FocusFirstCellOnEnter;
            grid1.Selection.FocusStyle = grid1.Selection.FocusStyle | SourceGrid.FocusStyle.RemoveFocusCellOnLeave;

            chkTabStop.Checked = grid1.TabStop;
        }
Esempio n. 7
0
        public void GridFill <T>(
            SourceGrid.Grid grid,
            List <T> List,
            Func <T, Color, GridCellController> newCellController = null,
            List <KeyValuePair <string, IComparer> > Fields       = null)
        {
            grid.Columns.Clear();
            grid.Rows.Clear();

            List <KeyValuePair <string, IComparer> > fields = Fields ?? new List <KeyValuePair <String, IComparer> >()
            {
                new KeyValuePair <string, IComparer>("Undefined", null)
            };

            //Columns filling
            grid.ColumnsCount = fields.Count;
            grid.FixedRows    = 1;
            grid.Rows.Insert(0);
            for (int i = 0; i < (fields.Count); i++)
            {
                SourceGrid.Cells.ColumnHeader ColumnHeader = new SourceGrid.Cells.ColumnHeader(fields[i].Key)
                {
                    SortComparer = fields[i].Value
                };
                grid[0, i] = ColumnHeader;
            }

            //Data filling
            GridUpdateOrInsertRows(grid, List, newCellController);
        }
Esempio n. 8
0
        private void frmSample14_Load(object sender, System.EventArgs e)
        {
            grid.BorderStyle = BorderStyle.FixedSingle;

            grid.ColumnsCount = 4;
            grid.FixedRows    = 1;
            grid.Rows.Insert(0);

            SourceGrid.Cells.Editors.ComboBox cbEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(string));
            cbEditor.StandardValues = new string[] { "Value 1", "Value 2", "Value 3" };
            cbEditor.EditableMode   = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.SingleClick | SourceGrid.EditableMode.AnyKey;

            grid[0, 0] = new SourceGrid.Cells.ColumnHeader("String");
            grid[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime");
            grid[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox");
            grid[0, 3] = new SourceGrid.Cells.ColumnHeader("ComboBox");
            for (int r = 1; r < 10; r++)
            {
                grid.Rows.Insert(r);
                grid[r, 0]      = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string));
                grid[r, 1]      = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime));
                grid[r, 2]      = new SourceGrid.Cells.CheckBox(null, true);
                grid[r, 3]      = new SourceGrid.Cells.Cell("Value 1", cbEditor);
                grid[r, 3].View = SourceGrid.Cells.Views.ComboBox.Default;
            }

            grid.AutoSizeCells();
        }
Esempio n. 9
0
        private void InitGridPIC()
        {
            this.gridList.Rows.Clear();

            SourceGrid.Cells.ColumnHeader header;

            this.gridList.ColumnsCount = 4;
            this.gridList.FixedRows    = 1;
            this.gridList.RowsCount    = 1;

            //Font font = new Font(this.Font, FontStyle.Bold);
            header = new SourceGrid.Cells.ColumnHeader(Translator.Instance.T("状态"));
            //header.View.Font = font;
            this.gridList[0, 0] = header;

            header = new SourceGrid.Cells.ColumnHeader(Translator.Instance.T("摄像头"));
            this.gridList[0, 1] = header;
            header = new SourceGrid.Cells.ColumnHeader(Translator.Instance.T("截图时间"));
            this.gridList[0, 2] = header;
            header = new SourceGrid.Cells.ColumnHeader(Translator.Instance.T("文件大小"));
            this.gridList[0, 3] = header;

            this.gridList.AutoSizeCells();
            this.gridList.AutoStretchColumnsToFitWidth = true;
            this.gridList.SelectionMode = SourceGrid.GridSelectionMode.Row;
        }
Esempio n. 10
0
        /// <summary>
        /// Creates a header row in the TableLayoutPanel. Header text is page section name in XML file.
        /// </summary>
        /// <param name="pageName"></param>
        private void CreatePageResourceHeader(string pageName)
        {
            var pageHeader = new Cell
            {
                BackColor     = Color.LightBlue,
                Font          = PageHeaderFont,
                TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft,
            };

            grid1.Rows.Insert(RowCount);


            grid1[RowCount, 0] = new SourceGrid.Cells.Cell(pageName)
            {
                View = pageHeader, ColumnSpan = 3
            };
            grid1[RowCount, 1].AddController(new SourceGrid.Cells.Controllers.Unselectable());
            grid1.Rows[RowCount].Height = 50;

            RowCount++;

            grid1.Rows.Insert(RowCount);
            grid1[RowCount, 0] = new SourceGrid.Cells.ColumnHeader("Original Resource");
            grid1[RowCount, 1] = new SourceGrid.Cells.ColumnHeader("Resource Name");
            grid1[RowCount, 2] = new SourceGrid.Cells.ColumnHeader("Localized Resource");


            RowCount++;
        }
Esempio n. 11
0
        private void ConfigurarGrillaSegmentos()
        {
            Grid.Rows.Clear();
            Grid.Redim(1, 14);


            Grid.FixedRows = 1;

            Grid[0, 0] = new SourceGrid.Cells.ColumnHeader("CONSECUTIVO");
            Grid[0, 1] = new SourceGrid.Cells.ColumnHeader("HORA RECEPCION");
            Grid[0, 2] = new SourceGrid.Cells.ColumnHeader("ENVIADO");
            Grid[0, 3] = new SourceGrid.Cells.ColumnHeader("RECIBIDO");
            Grid[0, 4] = new SourceGrid.Cells.ColumnHeader("IP ORIGEN");
            Grid[0, 5] = new SourceGrid.Cells.ColumnHeader("IP DESTINO");
            Grid[0, 6] = new SourceGrid.Cells.ColumnHeader("PUERTO ORIGEN");
            Grid[0, 7] = new SourceGrid.Cells.ColumnHeader("PUERTO DESTINO");
            Grid[0, 8] = new SourceGrid.Cells.ColumnHeader("SEQ NUMBER");
            Grid[0, 9] = new SourceGrid.Cells.ColumnHeader("ACK NUMBER");
            Grid[0, 10] = new SourceGrid.Cells.ColumnHeader("SYN FLAG");
            Grid[0, 11] = new SourceGrid.Cells.ColumnHeader("ACK FLAG");
            Grid[0, 12] = new SourceGrid.Cells.ColumnHeader("FIN FLAG");
            Grid[0, 13] = new SourceGrid.Cells.ColumnHeader("DATA LENGTH");


            Grid.SelectionMode = SourceGrid.GridSelectionMode.Row;
            Grid.Columns.AutoSize(true);
        }
Esempio n. 12
0
        private void frmSample14_Load(object sender, System.EventArgs e)
        {
            grid1.BorderStyle = BorderStyle.FixedSingle;

            grid1.ColumnsCount = 3;
            grid1.FixedRows    = 1;
            grid1.Rows.Insert(0);

            RTLColumnHeaderView viewHeader   = new RTLColumnHeaderView();
            RTLCheckBoxView     viewCheckBox = new RTLCheckBoxView();

            grid1[0, 0]      = new SourceGrid.Cells.ColumnHeader("String");
            grid1[0, 0].View = viewHeader;
            grid1[0, 1]      = new SourceGrid.Cells.ColumnHeader("DateTime");
            grid1[0, 1].View = viewHeader;
            grid1[0, 2]      = new SourceGrid.Cells.ColumnHeader("CheckBox");
            grid1[0, 2].View = viewHeader;
            for (int r = 1; r < 10; r++)
            {
                grid1.Rows.Insert(r);
                grid1[r, 0]      = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string));
                grid1[r, 1]      = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime));
                grid1[r, 2]      = new SourceGrid.Cells.CheckBox(null, true);
                grid1[r, 2].View = viewCheckBox;
            }

            grid1.AutoSizeCells();
        }
Esempio n. 13
0
        private void InitializeGrid(object sender, System.EventArgs e)
        {
            grid1.BorderStyle = BorderStyle.FixedSingle;
            grid1.ColumnsCount = 3;

            // create header
            grid1.Rows.Insert(0);
            grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("RichTextBox");
            grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("RichTextBox");
            grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("RichTextBox");

            // create 10 rows
            for (Int32 r = 1; r < 10; r++ )
            {
                grid1.Rows.Insert(r);

                // create three columns
                for (Int32 c = 0; c < 3; c++)
                {
                    // create richTextBox
                    SourceGrid.Cells.RichTextBox richTextBox = CreateRichTextBox();
                    SourceGrid.Cells.Views.RichTextBox richTextBoxView = CreateRichTextBoxView();
                    SourceGrid.Cells.Editors.RichTextBox editor = new SourceGrid.Cells.Editors.RichTextBox();
                    editor.Control.Multiline = true;
                    grid1[r, c] = richTextBox;
                    grid1[r, c].Editor = editor;
                    grid1[r, c].View = richTextBoxView;
                }
            }

            grid1.AutoSizeCells();
        }
Esempio n. 14
0
        public void GridBindData(SourceGrid.Grid urlGrid)
        {
            urlGrid.Rows.Clear();
            urlGrid.Rows.Insert(0);

            urlGrid[0, 0] = new SourceGrid.Cells.ColumnHeader("URL");
            urlGrid[0, 1] = new SourceGrid.Cells.ColumnHeader("Sync\nPosition");
            urlGrid[0, 2] = new SourceGrid.Cells.ColumnHeader("Sync\nScreenshots");

            int r = 1;

            foreach (SyncURL syncURL in _settings.syncURLs)
            {
                urlGrid.Rows.Insert(r);
                urlGrid[r, 0]        = new SourceGrid.Cells.Cell(syncURL.URL, typeof(string));
                urlGrid[r, 0].Editor = null;
                urlGrid[r, 1]        = new SourceGrid.Cells.CheckBox(null, syncURL.syncPosition);
                urlGrid[r, 1].Editor = null;
                urlGrid[r, 2]        = new SourceGrid.Cells.CheckBox(null, syncURL.syncScreenshot);
                urlGrid[r, 2].Editor = null;
                urlGrid[r, 3]        = new SourceGrid.Cells.Button("Edit");
                urlGrid[r, 3].Editor = null;
                urlGrid[r, 3].AddController(gridEditEvent);
                urlGrid[r, 4]        = new SourceGrid.Cells.Button("Delete");
                urlGrid[r, 4].Editor = null;
                urlGrid[r, 4].AddController(gridDeleteEvent);

                urlGrid[r, 5] = new SourceGrid.Cells.Cell(syncURL.id, typeof(string));

                r++;
            }

            urlGrid.AutoSizeCells();
        }
Esempio n. 15
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            grid1.Redim(10, 3);

            CellClickEvent clickController  = new CellClickEvent();
            PopupMenu      menuController   = new PopupMenu();
            CellCursor     cursorController = new CellCursor();

            for (int r = 0; r < grid1.Rows.Count; r++)
            {
                if (r == 0)
                {
                    grid1[r, 0] = new SourceGrid.Cells.ColumnHeader("Click event");
                    grid1[r, 1] = new SourceGrid.Cells.ColumnHeader("Custom Cursor");
                    grid1[r, 2] = new SourceGrid.Cells.ColumnHeader("ContextMenu");
                }
                else
                {
                    grid1[r, 0] = new SourceGrid.Cells.Cell("Value " + r.ToString(), typeof(string));
                    grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Now, typeof(DateTime));
                    grid1[r, 2] = new SourceGrid.Cells.Cell("Right click");
                }

                grid1[r, 0].AddController(clickController);
                grid1[r, 1].AddController(cursorController);
                grid1[r, 2].AddController(menuController);
            }

            grid1.AutoSizeCells();
        }
Esempio n. 16
0
        public SettingsForm(Plugin plugin)
        {
            InitializeComponent();
            this.plugin = plugin;

            variableTypeNames[typeof(RelativeTimerChannel).FullName] = "Relative timer";
            //variableTypeNames[typeof(AbsoluteTimerChannel).FullName] = "Absolute timer";

            foreach (KeyValuePair <string, string> pair in variableTypeNames)
            {
                channelNames.Add(pair.Value);
            }

            grid.SelectionMode = SourceGrid.GridSelectionMode.Row;
            grid.Selection.EnableMultiSelection = false;

            DevAge.Drawing.RectangleBorder b = grid.Selection.Border;
            b.SetWidth(0);
            grid.Selection.Border         = b;
            grid.Selection.FocusBackColor = grid.Selection.BackColor;

            grid.ColumnsCount = 3;
            grid.RowsCount    = 1;
            grid[0, 0]        = new SourceGrid.Cells.ColumnHeader("Timer name");
            grid[0, 1]        = new SourceGrid.Cells.ColumnHeader("Type");
            grid[0, 2]        = new SourceGrid.Cells.ColumnHeader("Interval [ms]");

            LoadChannels();

            grid.AutoStretchColumnsToFitWidth = true;
            grid.AutoSizeCells();
        }
Esempio n. 17
0
        public SettingsForm(Plugin plugin)
        {
            InitializeComponent();
            this.plugin = plugin;

            grid.SelectionMode = SourceGrid.GridSelectionMode.Row;
            grid.Selection.EnableMultiSelection = false;

            DevAge.Drawing.RectangleBorder b = grid.Selection.Border;
            b.SetWidth(0);
            grid.Selection.Border         = b;
            grid.Selection.FocusBackColor = grid.Selection.BackColor;

            grid.ColumnsCount = 4;
            grid.RowsCount    = 1;
            grid[0, 0]        = new SourceGrid.Cells.ColumnHeader("Channel name");
            grid[0, 1]        = new SourceGrid.Cells.ColumnHeader("OPC channel");
            grid[0, 2]        = new SourceGrid.Cells.ColumnHeader("Server");
            grid[0, 3]        = new SourceGrid.Cells.ColumnHeader("Host");

            LoadChannels();

            grid.AutoStretchColumnsToFitWidth = true;
            grid.AutoSizeCells();
        }
Esempio n. 18
0
        /// <summary>
        /// 建立固定儲存格的內容,包括:標題列、標題行。
        /// </summary>
        private void CreateFixedArea()
        {
            brGrid.FixedColumns = DualEditForm.FixedColumns;
            brGrid.FixedRows    = DualEditForm.FixedRows;

            brGrid[0, 0]            = new SourceGrid.Cells.Header();
            brGrid[0, 0].View       = m_HeaderView;
            brGrid[0, 0].Row.Height = 22;
            //brGrid[0, 0].Column.AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;

            // column headers
            int cnt = 0;

            for (int col = FixedColumns; col < brGrid.ColumnsCount; col++)
            {
                cnt++;
                SourceGrid.Cells.ColumnHeader hdr = new SourceGrid.Cells.ColumnHeader(cnt.ToString());
                //hdr.EnableResize = false;
                brGrid[0, col]      = hdr;
                brGrid[0, col].View = m_HeaderView;
            }

            // row headers
            cnt = 1;
            for (int row = FixedRows; row < brGrid.RowsCount; row += 3)
            {
                SourceGrid.Cells.RowHeader hdr = new SourceGrid.Cells.RowHeader(cnt.ToString());
                brGrid[row, 0]      = hdr;
                brGrid[row, 0].View = m_HeaderView;
                hdr.RowSpan         = 3;                // 不可以在指定 hdr 物件之前設定 RowSpan, 否則會出錯!
                cnt++;
            }

            RefreshRowNumbers();
        }
Esempio n. 19
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            grid.Redim(1, 3);

            grid.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
            grid.Columns[1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
            grid.Columns[2].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch;

            grid.FixedRows = 1;

            grid[0, 0] = new SourceGrid.Cells.ColumnHeader("Date");
            grid[0, 1] = new SourceGrid.Cells.ColumnHeader("Type");
            grid[0, 2] = new SourceGrid.Cells.ColumnHeader("Description");

            grid.AutoStretchColumnsToFitWidth = true;
            grid.SelectionMode = SourceGrid.GridSelectionMode.Row;

            AddLog("Log", "Application Started");


            for (int i = 0; i < 3; i++)
            {
               
                AddLog("Log", "Application test " + i.ToString());
            }

            grid.Columns.AutoSize(true);
            grid.Columns.StretchToFit();
        }
Esempio n. 20
0
        private void frmSample45_Load(object sender, EventArgs e)
        {
            grid1.BorderStyle = BorderStyle.FixedSingle;

            grid1.ColumnsCount = 3;
            grid1.FixedRows = 1;
            grid1.Rows.Insert(0);
            grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String");
            grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime");
            grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox");
            for (int r = 1; r < 10; r++)
            {
                grid1.Rows.Insert(r);
                grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string));
                grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime));
                grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true);
            }

            grid1.AutoSizeCells();

            grid1.Selection.FocusStyle = grid1.Selection.FocusStyle | SourceGrid.FocusStyle.FocusFirstCellOnEnter;
            grid1.Selection.FocusStyle = grid1.Selection.FocusStyle | SourceGrid.FocusStyle.RemoveFocusCellOnLeave;

            chkTabStop.Checked = grid1.TabStop;
        }
Esempio n. 21
0
        public void Bug_3424()
        {
            var grid1 = new Grid();

            grid1.ColumnsCount = 3;
            grid1.FixedRows    = 1;
            grid1.Rows.Insert(0);

            SourceGrid.Cells.ColumnHeader header1 = new SourceGrid.Cells.ColumnHeader("String");

            // here you can se the other column to sort when the current column is equal
            header1.SortComparer = new SourceGrid.MultiColumnsComparer(1, 2);

            var sorter = new SourceGrid.Cells.ColumnHeader("CheckBox");

            grid1[0, 0] = header1;
            grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime");
            grid1[0, 2] = sorter;
            for (int r = 1; r < 10; r++)
            {
                grid1.Rows.Insert(r);
                grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string));
                grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today.AddDays(7 * r), typeof(DateTime));
                grid1[r, 2] = new SourceGrid.Cells.CheckBox("", true);
            }

            grid1[9, 2]            = null;
            grid1[9, 1].ColumnSpan = 2;

            sorter.Sort(true);
        }
Esempio n. 22
0
        private void InitGrid()
        {
            SourceGrid.Cells.ColumnHeader header;

            this.logGrid.ColumnsCount = 5;
            this.logGrid.FixedRows    = 1;
            this.logGrid.RowsCount    = 1;

            //Font font = new Font(this.Font, FontStyle.Bold);
            header = new SourceGrid.Cells.ColumnHeader("#");
            //header.View.Font = font;

            //header.View = viewColumnHeader;
            this.logGrid[0, 0] = header;
            header             = new SourceGrid.Cells.ColumnHeader(Translator.Instance.T("日志等级"));
            //header.View = viewColumnHeader;
            this.logGrid[0, 1] = header;
            header             = new SourceGrid.Cells.ColumnHeader(Translator.Instance.T("时间"));
            //header.View = viewColumnHeader;
            this.logGrid[0, 2] = header;
            header             = new SourceGrid.Cells.ColumnHeader(Translator.Instance.T("摄像头"));
            //header.View = viewColumnHeader;
            this.logGrid[0, 3] = header;
            header             = new SourceGrid.Cells.ColumnHeader(Translator.Instance.T("内容"));
            //header.View = viewColumnHeader;
            this.logGrid[0, 4] = header;

            this.logGrid.AutoSizeCells();
            this.logGrid.AutoStretchColumnsToFitWidth = true;
            this.logGrid.SelectionMode = SourceGrid.GridSelectionMode.Row;
        }
Esempio n. 23
0
 void addHeader(SourceGrid.Grid grid, int col, string text, int minWidth)
 {
     SourceGrid.Cells.ColumnHeader header;
     grid[0, col] = header = new SourceGrid.Cells.ColumnHeader(text);
     header.Column.MinimalWidth = minWidth;
     header.Column.Width        = minWidth;
     header.View = headerView;
 }
Esempio n. 24
0
        private void LoadCategorySample(string category, SourceGrid.Cells.Controllers.Button linkEvents, Type[] assemblyTypes, SourceGrid.Cells.Views.IView categoryView, SourceGrid.Cells.Views.IView headerView)
        {
            int row;

            //Create Category Row
            row = grid1.RowsCount;
            grid1.Rows.Insert(row);
            grid1[row, 0]            = new SourceGrid.Cells.Cell(category);
            grid1[row, 0].View       = categoryView;
            grid1[row, 0].ColumnSpan = grid1.ColumnsCount;

            //Create Headers
            row = grid1.RowsCount;
            grid1.Rows.Insert(row);

            SourceGrid.Cells.ColumnHeader header1 = new SourceGrid.Cells.ColumnHeader("Sample N?");
            header1.View = headerView;
            header1.AutomaticSortEnabled = false;
            grid1[row, 0] = header1;

            SourceGrid.Cells.ColumnHeader header2 = new SourceGrid.Cells.ColumnHeader("Description");
            header2.View = headerView;
            header2.AutomaticSortEnabled = false;
            grid1[row, 1] = header2;

            //Create Data Cells
            for (int i = 0; i < assemblyTypes.Length; i++)
            {
                object[] attributes = assemblyTypes[i].GetCustomAttributes(typeof(SampleAttribute), true);
                if (attributes != null && attributes.Length > 0)
                {
                    SampleAttribute sampleAttribute = (SampleAttribute)attributes[0];

                    if (sampleAttribute.Category == category)
                    {
                        row = grid1.RowsCount;
                        grid1.Rows.Insert(row);
                        grid1[row, 0]      = new SourceGrid.Cells.Cell(sampleAttribute.SampleNumber);
                        grid1[row, 0].View = new SourceGrid.Cells.Views.Cell();
                        grid1[row, 0].View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;

                        //Create a cell with a link
                        grid1[row, 1]     = new SourceGrid.Cells.Link(sampleAttribute.Description);
                        grid1[row, 1].Tag = assemblyTypes[i];
                        grid1[row, 1].Controller.AddController(linkEvents);
                    }
                }
            }

            //Enable sorting of the category range
            SourceGrid.RangeLoader headerRange = new SourceGrid.RangeLoader(new SourceGrid.Range(header1.Range.Start.Row, 0, header1.Range.Start.Row, 1));
            SourceGrid.RangeLoader rangeToSort = new SourceGrid.RangeLoader(new SourceGrid.Range(header1.Range.Start.Row + 1, 0, row, 1));
            SourceGrid.Cells.Controllers.SortableHeader sortableController = new SourceGrid.Cells.Controllers.SortableHeader(rangeToSort, headerRange);

            header1.AddController(sortableController);
            header1.Sort(true);
            header2.AddController(sortableController);
        }
Esempio n. 25
0
        private void frmSample17_Load(object sender, System.EventArgs e)
        {
            grid1.Redim(40, 40);
            grid1.FixedColumns = 1;
            grid1.FixedRows    = 1;

            grid1[0, 0] = new SourceGrid.Cells.Header(null);
            for (int c = 1; c < grid1.ColumnsCount; c++)
            {
                SourceGrid.Cells.ColumnHeader header = new SourceGrid.Cells.ColumnHeader("Header " + c.ToString());
                header.AutomaticSortEnabled = false;

                //header.ColumnSelectorEnabled = true;
                //header.ColumnFocusEnabled = true;

                grid1[0, c] = header;
            }

            Random rnd = new Random();

            for (int r = 1; r < grid1.RowsCount; r++)
            {
                grid1[r, 0] = new SourceGrid.Cells.RowHeader("Header " + r.ToString());
                for (int c = 1; c < grid1.ColumnsCount; c++)
                {
                    if (rnd.NextDouble() > 0.20)
                    {
                        grid1[r, c] = new SourceGrid.Cells.Cell(r * c, typeof(int));
                    }
                    else
                    {
                        grid1[r, c] = null;
                    }
                }
            }

            var selection = grid1.Selection as SelectionBase;

            cPickSelBackColor.SelectedColor = Color.FromArgb(selection.BackColor.R, selection.BackColor.G, selection.BackColor.B);
            cPckBorderColor.SelectedColor   = selection.Border.Top.Color;
            trackSelectionAlpha.Value       = (int)selection.BackColor.A;
            trackBorderWidth.Value          = (int)selection.Border.Top.Width;

            cPickFocusBackColor.SelectedColor = Color.FromArgb(selection.FocusBackColor.R, selection.FocusBackColor.G, selection.FocusBackColor.B);
            trackFocusBackColorTrans.Value    = selection.FocusBackColor.A;


            this.cPickSelBackColor.SelectedColorChanged   += new System.EventHandler(this.cPickSelBackColor_SelectedColorChanged);
            this.cPckBorderColor.SelectedColorChanged     += new System.EventHandler(this.cPckBorderColor_SelectedColorChanged);
            this.trackSelectionAlpha.ValueChanged         += new System.EventHandler(this.trackSelectionAlpha_ValueChanged);
            this.trackBorderWidth.ValueChanged            += new System.EventHandler(this.trackBorderWidth_ValueChanged);
            this.trackFocusBackColorTrans.ValueChanged    += new System.EventHandler(this.trackFocusBackColorTrans_ValueChanged);
            this.cPickFocusBackColor.SelectedColorChanged += new System.EventHandler(this.cPickFocusBackColor_SelectedColorChanged);

            cbDashStyle.Validator = new DevAge.ComponentModel.Validator.ValidatorTypeConverter(typeof(System.Drawing.Drawing2D.DashStyle));
            cbDashStyle.Value     = selection.Border.Top.DashStyle;
        }
Esempio n. 26
0
        private void InitGrid()
        {
            var headerView = new SourceGrid.Cells.Views.ColumnHeader();

            // Agrego la fila con los titulos de las columnas.
            var row = Grid.RowsCount;

            Grid.Rows.Insert(row);

            // la oculto por que esta por las dudas , quedo de mas.
            HeaderVehiculo = new SourceGrid.Cells.ColumnHeader(" Vehiculo ")
            {
                View = headerView,
                AutomaticSortEnabled = false
            };
            Grid[row, 0] = HeaderVehiculo;

            HeaderEstado = new SourceGrid.Cells.ColumnHeader(" Estado ")
            {
                View = headerView,
                AutomaticSortEnabled = false
            };
            Grid[row, 1] = HeaderEstado;

            HeaderDatosPendientes = new SourceGrid.Cells.ColumnHeader(" Datos Pendientes ")
            {
                View = headerView,
                AutomaticSortEnabled = false
            };
            Grid[row, 2] = HeaderDatosPendientes;

            HeaderProgreso = new SourceGrid.Cells.ColumnHeader(" Progreso ")
            {
                View = headerView,
                AutomaticSortEnabled = false
            };
            Grid[row, 3] = HeaderProgreso;

            HeaderDatos = new SourceGrid.Cells.ColumnHeader(" Datos adicionales ")
            {
                View = headerView,
                AutomaticSortEnabled = false
            };
            Grid[row, 4] = HeaderDatos;


            Grid.Columns[0].AutoSizeMode      = SourceGrid.AutoSizeMode.EnableAutoSize;
            Grid.Columns[1].AutoSizeMode      = SourceGrid.AutoSizeMode.EnableAutoSize;
            Grid.Columns[2].AutoSizeMode      = SourceGrid.AutoSizeMode.EnableAutoSize;
            Grid.Columns[3].MinimalWidth      = 100;
            Grid.Columns[3].AutoSizeMode      = SourceGrid.AutoSizeMode.None;
            Grid.Columns[4].AutoSizeMode      = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch;
            Grid.AutoStretchColumnsToFitWidth = true;
            Grid.AutoSizeCells();
            Grid.Columns.StretchToFit();
        }
Esempio n. 27
0
        /// <summary>
        /// Chargement du formulaire
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmInfo_Load(object sender, EventArgs e)
        {
            _frm = (frmAppli)this.Owner;
            txtCode.Text = _infoEcole.IdEcole;
            txtLibelle.Text = _infoEcole.Libelle;
            txtAdresse.Text = _infoEcole.Adresse;
            txtCP.Text = _infoEcole.CodePostal;
            txtVille.Text = _infoEcole.Ville;
            txtTelephone.Text = _infoEcole.Telephone;

            txtPrivateInfo.Text = _infoEcole.PrivateInfo;
            txtNbClass.Text = _infoEcole.NbClasses;
            txtEffectif.Text = _infoEcole.Effectif;
            if (!String.IsNullOrEmpty(_infoEcole.NbClassesMaternelle)) { txtNbMaternelle.Text = _infoEcole.NbClassesMaternelle; }
            if (!String.IsNullOrEmpty(_infoEcole.NbClassesElementaire)) { txtNbElementaire.Text = _infoEcole.NbClassesElementaire; }
            if (!String.IsNullOrEmpty(_infoEcole.NbClassesCollege)) { txtNbCollege.Text = _infoEcole.NbClassesCollege; }

            if (_infoEcole.TypSecteur == "0") { typSecteur.SelectedIndex = 0; }
            else { typSecteur.SelectedIndex = 1;}

            // Informations sur le contact
            if (_infoEcole.Contact != null)
            {
                txtNomContact.Text = _infoEcole.Contact.NomCTC;
                txtFonction.Text = _infoEcole.Contact.FonctionCTC;
                mskTelContact.Text = _infoEcole.Contact.TelephoneCTC;
                mskPortContact.Text = _infoEcole.Contact.PortableCTC;
                mskFaxContact.Text = _infoEcole.Contact.FaxCTC;
                txtEmail.Text = _infoEcole.Contact.EmailCTC;
                rchComplements.Text = _infoEcole.Contact.ComplementsCTC;
            }
            // Disponibilité
            chkDay1.Checked = _infoEcole.getDispo(1);
            chkDay2.Checked = _infoEcole.getDispo(2);
            chkDay3.Checked = _infoEcole.getDispo(3);
            chkDay4.Checked = _infoEcole.getDispo(4);
            chkDay5.Checked = _infoEcole.getDispo(5);

            // Informations sur les autres planifications
            grid2.BorderStyle = BorderStyle.FixedSingle;
            grid2.ColumnsCount = 4;
            grid2.FixedRows = 1;
            grid2.Rows.Insert(0);
            grid2.Selection.FocusStyle = FocusStyle.None;
            grid2.SelectionMode = GridSelectionMode.Row;
            grid2[0, 0] = new SourceGrid.Cells.ColumnHeader("Saison");
            grid2[0, 1] = new SourceGrid.Cells.ColumnHeader("Du");
            grid2[0, 2] = new SourceGrid.Cells.ColumnHeader("Au");
            grid2[0, 3] = new SourceGrid.Cells.ColumnHeader("Photographe");
            grid2.Columns.SetWidth(0, 100);
            grid2.Columns.SetWidth(1, 120);
            grid2.Columns.SetWidth(2, 120);
            grid2.Columns.SetWidth(3, 100);
            this.loadLstPlanif();
        }
Esempio n. 28
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            grid1.BorderStyle = BorderStyle.FixedSingle;

            grid1.ColumnsCount = 3;
            grid1.FixedRows    = 1;
            grid1.Rows.Insert(0);

            DevAge.Drawing.RectangleBorder border = new DevAge.Drawing.RectangleBorder(new DevAge.Drawing.BorderLine(Color.DarkGreen), new DevAge.Drawing.BorderLine(Color.DarkGreen));

            DevAge.Drawing.VisualElements.ColumnHeader flatHeader = new DevAge.Drawing.VisualElements.ColumnHeader();
            flatHeader.Border               = border;
            flatHeader.BackColor            = Color.ForestGreen;
            flatHeader.BackgroundColorStyle = DevAge.Drawing.BackgroundColorStyle.Solid;
            SourceGrid.Cells.Views.ColumnHeader headerView = new SourceGrid.Cells.Views.ColumnHeader();
            headerView.Font       = new Font(grid1.Font, FontStyle.Bold | FontStyle.Underline);
            headerView.Background = flatHeader;
            headerView.ForeColor  = Color.White;

            SourceGrid.Cells.Views.Cell cellView = new SourceGrid.Cells.Views.Cell();
            cellView.Background = new DevAge.Drawing.VisualElements.BackgroundLinearGradient(Color.ForestGreen, Color.White, 45);
            cellView.Border     = border;
            SourceGrid.Cells.Views.CheckBox checkView = new SourceGrid.Cells.Views.CheckBox();
            checkView.Background = new DevAge.Drawing.VisualElements.BackgroundLinearGradient(Color.ForestGreen, Color.White, 45);
            checkView.Border     = border;


            grid1[0, 0]      = new SourceGrid.Cells.ColumnHeader("String");
            grid1[0, 0].View = headerView;

            grid1[0, 1]      = new SourceGrid.Cells.ColumnHeader("DateTime");
            grid1[0, 1].View = headerView;

            grid1[0, 2]      = new SourceGrid.Cells.ColumnHeader("CheckBox");
            grid1[0, 2].View = headerView;
            for (int r = 1; r < 10; r++)
            {
                grid1.Rows.Insert(r);

                grid1[r, 0]      = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string));
                grid1[r, 0].View = cellView;

                grid1[r, 1]      = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime));
                grid1[r, 1].View = cellView;

                grid1[r, 2]      = new SourceGrid.Cells.CheckBox(null, true);
                grid1[r, 2].View = checkView;
            }

            grid1.AutoSizeCells();
        }
Esempio n. 29
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            grid1.BorderStyle = BorderStyle.FixedSingle;

            grid1.ColumnsCount = 3;
            grid1.FixedRows = 1;
            grid1.Rows.Insert(0);

            DevAge.Drawing.RectangleBorder border = new DevAge.Drawing.RectangleBorder(new DevAge.Drawing.BorderLine(Color.DarkGreen), new DevAge.Drawing.BorderLine(Color.DarkGreen));

            DevAge.Drawing.VisualElements.ColumnHeader flatHeader = new DevAge.Drawing.VisualElements.ColumnHeader();
            flatHeader.Border = border;
            flatHeader.BackColor = Color.ForestGreen;
            flatHeader.BackgroundColorStyle = DevAge.Drawing.BackgroundColorStyle.Solid;
            SourceGrid.Cells.Views.ColumnHeader headerView = new SourceGrid.Cells.Views.ColumnHeader();
            headerView.Font = new Font(grid1.Font, FontStyle.Bold | FontStyle.Underline);
            headerView.Background = flatHeader;
            headerView.ForeColor = Color.White;

            SourceGrid.Cells.Views.Cell cellView = new SourceGrid.Cells.Views.Cell();
            cellView.Background = new DevAge.Drawing.VisualElements.BackgroundLinearGradient(Color.ForestGreen, Color.White, 45);
            cellView.Border = border;
            SourceGrid.Cells.Views.CheckBox checkView = new SourceGrid.Cells.Views.CheckBox();
            checkView.Background = new DevAge.Drawing.VisualElements.BackgroundLinearGradient(Color.ForestGreen, Color.White, 45);
            checkView.Border = border;


            grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String");
            grid1[0, 0].View = headerView;
            
            grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime");
            grid1[0, 1].View = headerView;

            grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox");
            grid1[0, 2].View = headerView;
            for (int r = 1; r < 10; r++)
            {
                grid1.Rows.Insert(r);

                grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string));
                grid1[r, 0].View = cellView;

                grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime));
                grid1[r, 1].View = cellView;

                grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true);
                grid1[r, 2].View = checkView;
            }

            grid1.AutoSizeCells();
        }
        void Initialize()
        {
            DevAge.Drawing.RectangleBorder b = channelsGrid.Selection.Border;
            b.SetWidth(0);
            channelsGrid.Selection.Border         = b;
            channelsGrid.Selection.FocusBackColor = channelsGrid.Selection.BackColor;
            channelsGrid.ColumnsCount             = 6;

            SourceGrid.Cells.Views.Cell categoryView = GetCategoryCellView();

            channelsGrid.RowsCount++;
            channelsGrid[0, 0] = new SourceGrid.Cells.ColumnHeader("Channel");
            channelsGrid[0, 1] = new SourceGrid.Cells.ColumnHeader("Value");
            channelsGrid[0, 2] = new SourceGrid.Cells.ColumnHeader("Status");
            channelsGrid[0, 3] = new SourceGrid.Cells.ColumnHeader("Time");
            channelsGrid[0, 4] = new SourceGrid.Cells.ColumnHeader("Access");
            channelsGrid[0, 5] = new SourceGrid.Cells.ColumnHeader("Type");

            foreach (string plugId in Env.Current.CommunicationPlugins.PluginIds)
            {
                LoadPlugin(categoryView, plugId);
            }

            channelsGrid.AutoStretchColumnsToFitWidth = true;
            channelsGrid.AutoSizeCells();
            channelsGrid.Selection.EnableMultiSelection = false;

            this.FormClosing += new FormClosingEventHandler(VariablesView_FormClosing);
            this.channelsGrid.Selection.SelectionChanged += new SourceGrid.RangeRegionChangedEventHandler(Selection_SelectionChanged);
            channelsGrid.MouseDoubleClick += new MouseEventHandler(channelsGrid_MouseDoubleClick);

            pluginsGrid.Selection.Border         = b;
            pluginsGrid.Selection.FocusBackColor = channelsGrid.Selection.BackColor;
            pluginsGrid.ColumnsCount             = 5;

            pluginsGrid.RowsCount++;
            pluginsGrid[0, 0] = new SourceGrid.Cells.ColumnHeader("Plugin Name");
            pluginsGrid[0, 1] = new SourceGrid.Cells.ColumnHeader("Variables");
            pluginsGrid[0, 2] = new SourceGrid.Cells.ColumnHeader("Start Plugin");
            pluginsGrid[0, 3] = new SourceGrid.Cells.ColumnHeader("Stop Plugin");
            pluginsGrid[0, 4] = new SourceGrid.Cells.ColumnHeader("Test mode");

            foreach (string plugId in Env.Current.CommunicationPlugins.PluginIds)
            {
                pluginsGrid.RowsCount++;
                pluginsGrid[pluginsGrid.RowsCount - 1, 0] = new SourceGrid.Cells.Cell(plugId);
                pluginsGrid[pluginsGrid.RowsCount - 1, 1] = new SourceGrid.Cells.Cell(Env.Current.CommunicationPlugins[plugId].Channels.Length);
                //pluginsGrid[pluginsGrid.RowsCount - 1, 2] = new SourceGrid.Cells.Button(new Object());
            }
            updateThread = new Thread(new ParameterizedThreadStart(updateThreadProc));
            updateThread.Start(this);
        }
Esempio n. 31
0
        public SettingsForm(Plugin plugin)
        {
            InitializeComponent();
            this.plugin = plugin;

            grid.SelectionMode = SourceGrid.GridSelectionMode.Row;
            grid.Selection.EnableMultiSelection = false;

            DevAge.Drawing.RectangleBorder b = grid.Selection.Border;
            b.SetWidth(0);
            grid.Selection.Border         = b;
            grid.Selection.FocusBackColor = grid.Selection.BackColor;

            grid.ColumnsCount           = 11;
            grid.RowsCount              = 1;
            grid[0, gridColName]        = new SourceGrid.Cells.ColumnHeader("Channel name");
            grid[0, gridColFSType]      = new SourceGrid.Cells.ColumnHeader("FS2 Channel Type");
            grid[0, gridColStation]     = new SourceGrid.Cells.ColumnHeader("Station Name");
            grid[0, gridColMODType]     = new SourceGrid.Cells.ColumnHeader("Register Type");
            grid[0, gridColAddress]     = new SourceGrid.Cells.ColumnHeader("Addr. Offset");
            grid[0, gridColRegister]    = new SourceGrid.Cells.ColumnHeader("Register Addr.");
            grid[0, gridColDevice]      = new SourceGrid.Cells.ColumnHeader("Device Idx");
            grid[0, gridColDevDataType] = new SourceGrid.Cells.ColumnHeader("MOD Data Type");
            grid[0, gridColDevDataLen]  = new SourceGrid.Cells.ColumnHeader("Data Length");
            grid[0, gridColConversion]  = new SourceGrid.Cells.ColumnHeader("Byte Swap");
            grid[0, gridColReadWrite]   = new SourceGrid.Cells.ColumnHeader("MOD R/W");
            grid.MouseDoubleClick      += new MouseEventHandler(grid_MouseDoubleClick);

            //grid.Controller.AddController(new ValueChangedEvent(grid));

            stationGrid.SelectionMode = SourceGrid.GridSelectionMode.Row;
            stationGrid.Selection.EnableMultiSelection = false;

            stationGrid.Selection.Border         = b;
            stationGrid.Selection.FocusBackColor = stationGrid.Selection.BackColor;

            stationGrid.ColumnsCount             = 4;
            stationGrid.RowsCount                = 1;
            stationGrid[0, stationGridColName]   = new SourceGrid.Cells.ColumnHeader("Station name");
            stationGrid[0, stationGridColActive] = new SourceGrid.Cells.ColumnHeader("Station Active");
            stationGrid[0, stationGridColAddr]   = new SourceGrid.Cells.ColumnHeader("Communication");
            stationGrid[0, stationGridColPara]   = new SourceGrid.Cells.ColumnHeader("Parameters");
            stationGrid.MouseDoubleClick        += new MouseEventHandler(stationGrid_MouseDoubleClick);
            LoadStations();
            LoadChannels();

            stationGrid.AutoStretchColumnsToFitWidth = true;
            stationGrid.AutoSizeCells();
            grid.AutoStretchColumnsToFitWidth = true;
            grid.AutoSizeCells();
        }
Esempio n. 32
0
        private void btLoad_Click(object sender, System.EventArgs e)
        {
            grid.Redim(0, 0);
            //Visual properties shared between all the cells
            SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
            view.BackColor = Color.Snow;

            //Editor (IDataModel) shared between all the cells
            SourceGrid.Cells.Editors.TextBox editor = new
                                                      SourceGrid.Cells.Editors.TextBox(typeof(string));

            grid.Redim(int.Parse(txtRows.Text), int.Parse(txtCols.Text));

            if (chkAddHeaders.Checked && grid.RowsCount > 0 &&
                grid.ColumnsCount > 0)
            {
                grid.FixedRows    = 1;
                grid.FixedColumns = 1;

                for (int r = grid.FixedRows; r < grid.RowsCount; r++)
                {
                    grid[r, 0] = new SourceGrid.Cells.RowHeader(r);
                }
                for (int c = grid.FixedColumns; c < grid.ColumnsCount; c++)
                {
                    SourceGrid.Cells.ColumnHeader header = new
                                                           SourceGrid.Cells.ColumnHeader(c);
                    header.AutomaticSortEnabled = false;
                    grid[0, c] = header;
                }
                grid[0, 0] = new SourceGrid.Cells.Header();
            }
            else
            {
                grid.FixedRows    = 0;
                grid.FixedColumns = 0;
            }

            for (int r = grid.FixedRows; r < grid.RowsCount; r++)
            {
                for (int c = grid.FixedColumns; c < grid.ColumnsCount; c++)
                {
                    grid[r, c] = new SourceGrid.Cells.Cell(r.ToString() + "," +
                                                           c.ToString());
                    grid[r, c].Editor = editor;
                    grid[r, c].View   = view;
                }
            }
            grid.Selection.Focus(new SourceGrid.Position(0, 0), true);
        }
Esempio n. 33
0
        private void LoadSchedule()
        {
            ScheduleGrid.BorderStyle = BorderStyle.None;
            ScheduleGrid.Rows.Insert(0);
            List <Worker> todayWorker = Enterprise.Personal.FindAll(date => date.TimeTable.Data.ContainsKey(monthCalendar.SelectionStart));

            ScheduleGrid.ColumnsCount = todayWorker.Count + 1;
            ScheduleGrid[0, 0]        = new SourceGrid.Cells.ColumnHeader(string.Empty);
            for (int i = 1; i <= todayWorker.Count; i++)
            {
                ScheduleGrid[0, i] = new SourceGrid.Cells.ColumnHeader($"{todayWorker[i - 1].About.Name}");
            }
            ScheduleGrid.FixedRows = 1;

            int j = 1;

            try
            {
                for (TimeSpan i = Enterprise.TimeTable[(Days)IndexDay() + 1][0];
                     i < Enterprise.TimeTable[(Days)IndexDay() + 1][1];
                     i = i + DateTime.Parse("00:30:00").TimeOfDay)
                {
                    ScheduleGrid.Rows.Insert(j);
                    ScheduleGrid[j, 0] = new SourceGrid.Cells.RowHeader($"{i} - {(i + DateTime.Parse("00:30:00").TimeOfDay)}");
                    for (int k = 1; k < ScheduleGrid.ColumnsCount; k++)
                    {
                        if (todayWorker[k - 1].TimeTable.Data[monthCalendar.SelectionStart.Date].End <= i ||
                            todayWorker[k - 1].TimeTable.Data[monthCalendar.SelectionStart.Date].Start > i)
                        {
                            ScheduleGrid[j, k]             = new SourceGrid.Cells.Cell("Не работает", typeof(string));
                            ScheduleGrid[j, k].ToolTipText = string.Empty;
                        }
                        else
                        {
                            ScheduleGrid[j, k]             = new SourceGrid.Cells.Cell(string.Empty, typeof(string));
                            ScheduleGrid[j, k].ToolTipText = string.Empty;
                        }
                    }
                    j++;
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                ScheduleGrid.Rows.RemoveRange(0, ScheduleGrid.Rows.Count);
            }
            finally
            {
                ScheduleGrid.AutoSizeCells();
            }
        }
Esempio n. 34
0
 private void ResetNotificationGrid()
 {
     gridNotifications.Rows.Clear();
     gridNotifications.BorderStyle  = System.Windows.Forms.BorderStyle.FixedSingle;
     gridNotifications.ColumnsCount = 7;
     gridNotifications.FixedRows    = 1;
     gridNotifications.Rows.Insert(0);
     gridNotifications[0, 0] = new SourceGrid.Cells.ColumnHeader("ID");
     gridNotifications[0, 1] = new SourceGrid.Cells.ColumnHeader("Alert");
     gridNotifications[0, 2] = new SourceGrid.Cells.ColumnHeader("To:");
     gridNotifications[0, 3] = new SourceGrid.Cells.ColumnHeader("Body");
     gridNotifications[0, 4] = new SourceGrid.Cells.ColumnHeader("Send?");
     gridNotifications[0, 5] = new SourceGrid.Cells.ColumnHeader("Send On");
     gridNotifications[0, 6] = new SourceGrid.Cells.ColumnHeader("Elapsed");
 }
Esempio n. 35
0
            public override void LoadGrid()
            {
                m_Grid.Selection.SelectionChanged    += new SourceGrid.RangeRegionChangedEventHandler(Selection_SelectionChanged);
                m_Grid.Selection.EnableMultiSelection = true;

                m_Grid.Redim(1, COLUMN_COUNT);

                m_Grid[0, 0] = new SourceGrid.Cells.ColumnHeader("Type");
                m_Grid[0, 1] = new SourceGrid.Cells.ColumnHeader("ID");
                m_Grid[0, 2] = new SourceGrid.Cells.ColumnHeader("Amount");

                m_Grid.Columns[0].Width = 80;
                m_Grid.Columns[1].Width = 60;
                m_Grid.Columns[2].Width = 60;
            }
Esempio n. 36
0
        public SettingsForm(Plugin plugin)
        {
            InitializeComponent();
            this.plugin = plugin;

            variableTypeNames[typeof(CurrentTimeChannel).FullName]      = "Current time";
            variableTypeNames[typeof(RandomIntegerChannel).FullName]    = "Random integer";
            variableTypeNames[typeof(SawIntegerChannel).FullName]       = "Saw (integer -100 .. 100)";
            variableTypeNames[typeof(RampIntegerChannel).FullName]      = "Ramp (integer 0 .. 100)";
            variableTypeNames[typeof(SinusDoubleChannel).FullName]      = "Sinus (double -1 .. 1)";
            variableTypeNames[typeof(GenericChannel <int>).FullName]    = "Simple integer";
            variableTypeNames[typeof(GenericChannel <string>).FullName] = "Simple string";
            variableTypeNames[typeof(GenericChannel <float>).FullName]  = "Simple float";
            variableTypeNames[typeof(ComputableChannel).FullName]       = "Computable";
            foreach (KeyValuePair <string, string> pair in variableTypeNames)
            {
                channelNames.Add(pair.Value);
            }

            grid.SelectionMode = SourceGrid.GridSelectionMode.Row;
            grid.Selection.EnableMultiSelection = false;

            DevAge.Drawing.RectangleBorder b = grid.Selection.Border;
            b.SetWidth(0);
            grid.Selection.Border         = b;
            grid.Selection.FocusBackColor = grid.Selection.BackColor;

            grid.ColumnsCount = 3;
            grid.RowsCount    = 1;
            grid[0, 0]        = new SourceGrid.Cells.ColumnHeader("Channel name");
            grid[0, 1]        = new SourceGrid.Cells.ColumnHeader("Type");
            grid[0, 2]        = new SourceGrid.Cells.ColumnHeader("Read only");

            string           iPyFormatXML = (new StreamReader(new MemoryStream(global::FreeSCADA.Communication.SimulatorPlug.Resources.IronPython))).ReadToEnd();
            SyntaxDefinition syntax       = SyntaxDefinition.FromSyntaxXml(iPyFormatXML);

            expressionEditBox.Document.Parser.Init(syntax);

            grid.Selection.SelectionChanged += new SourceGrid.RangeRegionChangedEventHandler(OnSelectionChanged);

            LoadChannels();

            grid.AutoStretchColumnsToFitWidth = true;
            grid.AutoSizeCells();

            InitializeTooltips();
            UpdateExpressionField();
        }
Esempio n. 37
0
        private void frmSample25_Load(object sender, System.EventArgs e)
        {
            grid.Redim(1, 3);

            grid.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
            grid.Columns[1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
            grid.Columns[2].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch;

            grid.FixedRows = 1;

            grid[0, 0] = new SourceGrid.Cells.ColumnHeader("Date");
            grid[0, 1] = new SourceGrid.Cells.ColumnHeader("Type");
            grid[0, 2] = new SourceGrid.Cells.ColumnHeader("Description");

            grid.AutoStretchColumnsToFitWidth = true;
            grid.SelectionMode = SourceGrid.GridSelectionMode.Row;

            AddLog("Log", "Application Started");


            //Create Data Cells
            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            Type[] assemblyTypes = assembly.GetTypes();
            for (int i = 0; i < assemblyTypes.Length; i++)
            {
                object[] attributes = assemblyTypes[i].GetCustomAttributes(typeof(SampleAttribute), true);
                if (attributes != null && attributes.Length > 0)
                {
                    SampleAttribute sampleAttribute = (SampleAttribute)attributes[0];

                    AddLog("Log Menu", "Add menu for " + sampleAttribute.Description + " " + assemblyTypes[i].Name);

                    if (assemblyTypes[i] != this.GetType())
                    {
                        MenuItem menu = new MenuForm(this, assemblyTypes[i], sampleAttribute.Description + " " + sampleAttribute.SampleNumber.ToString());
                        mnWindow.MenuItems.Add(menu);
                    }
                }
            }

            for (int i = 0; i < 200; i++)
            {
                AddLog("Log", "Application test " + i.ToString());
            }

            grid.Columns.AutoSize(true);
            grid.Columns.StretchToFit();
        }
Esempio n. 38
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            grid1.Redim(30, 2);

            grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("Checked");
            grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("CheckStatus");

            SourceGrid.Cells.Editors.ComboBox combo = new SourceGrid.Cells.Editors.ComboBox(typeof(DevAge.Drawing.CheckBoxState));

            DependencyColumn boolToStatus = new DependencyColumn(1);
            boolToStatus.ConvertFunction = delegate(object valBool)
                                            {
                                                if (valBool == null)
                                                    return DevAge.Drawing.CheckBoxState.Undefined;
                                                else if ((bool)valBool == true)
                                                    return DevAge.Drawing.CheckBoxState.Checked;
                                                else
                                                    return DevAge.Drawing.CheckBoxState.Unchecked;
                                            };

            DependencyColumn statusToBool = new DependencyColumn(0);
            statusToBool.ConvertFunction = delegate(object valStatus)
                                            {
                                                DevAge.Drawing.CheckBoxState status = 
                                                    (DevAge.Drawing.CheckBoxState)valStatus;

                                                if (status == DevAge.Drawing.CheckBoxState.Undefined)
                                                    return null;
                                                else if (status == DevAge.Drawing.CheckBoxState.Checked)
                                                    return true;
                                                else
                                                    return false;
                                            };

            for (int r = 1; r < grid1.RowsCount; r++)
            {
                grid1[r, 0] = new SourceGrid.Cells.CheckBox(null, null);
                grid1[r, 0].Editor.AllowNull = true;
                grid1[r, 0].AddController(boolToStatus);

                grid1[r, 1] = new SourceGrid.Cells.Cell(DevAge.Drawing.CheckBoxState.Undefined, combo);
                grid1[r, 1].AddController(statusToBool);
            }

            grid1.AutoSizeCells();
        }
Esempio n. 39
0
        /// <summary>
        /// 为SourceGrid绑定数据源
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="data"></param>
        public void BindSourceGrid(SourceGrid.Grid grid, DataTable data, string colName)
        {
            int[] ColumnWidth = new int[] { 40, 200};
            //PopupMenu menuController = new PopupMenu();
            if (grid.RowsCount > 0)
            {
                //清除原表格内容
                grid.Rows.RemoveRange(0, grid.RowsCount);
            }
            grid.SelectionMode = SourceGrid.GridSelectionMode.Row;//选行模式
            grid.Selection.EnableMultiSelection = false; //行不允许多选
            grid.BorderStyle = BorderStyle.FixedSingle;
            grid.ColumnsCount = 2;
            grid.FixedRows = 1;
            BuildGridColumnWidth(grid, ColumnWidth);
            grid.Rows.Insert(0);
            grid[0, 0] = new SourceGrid.Cells.ColumnHeader("ID");
            grid[0, 1] = new SourceGrid.Cells.ColumnHeader(colName);

            grid[0, 1].View.Font = new Font("宋体", 10, FontStyle.Bold);

            //隐藏列
            grid[0, 0].Column.Visible = false;

            grid[0, 0].View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;

            for (int i = 1; i < data.Rows.Count + 1; i++)
            {
                grid.Rows.Insert(i);
                //设置行高
                grid.Rows.SetHeight(i, 30);

                #region 表体塞值

                //表体塞值
                grid[i, 0] = new SourceGrid.Cells.Cell(data.Rows[i - 1][0], typeof(int)); //id
                grid[i, 1] = new SourceGrid.Cells.Cell(data.Rows[i - 1][1], typeof(string));//名称

                #endregion

                //设置单元格不可编辑
                grid[i, 0].Editor.EnableEdit = false;
                grid[i, 1].Editor.EnableEdit = false;

            }
            grid.Refresh();
        }
Esempio n. 40
0
        /// <summary>
        /// Chargement de l'onglet Messages
        /// </summary>
        private void loadTab4()
        {
            p_modelModified = false;
            this.loadComboModels();

            lstDocuments.BorderStyle = BorderStyle.FixedSingle;
            lstDocuments.ColumnsCount = 2;
            lstDocuments.FixedRows = 1;
            lstDocuments.Rows.Insert(0);
            lstDocuments.Selection.FocusStyle = FocusStyle.None;
            lstDocuments.SelectionMode = GridSelectionMode.Row;
            lstDocuments[0, 0] = new SourceGrid.Cells.ColumnHeader("Nom");
            lstDocuments[0, 1] = new SourceGrid.Cells.ColumnHeader("Chemin");
            lstDocuments.Columns.SetWidth(0, 150);
            lstDocuments.Columns.SetWidth(1, 200);
            this.loadLstDocument();            

        }
Esempio n. 41
0
        protected override void ConfigurarGrillaEncapsulacion()
        {
            Grid.Rows.Clear();
            Grid.Redim(1, 3);

            Grid.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
            Grid.Columns[1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
            Grid.Columns[2].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch;

            Grid.FixedRows = 1;

            Grid[0, 0] = new SourceGrid.Cells.ColumnHeader("CONSECUTIVO");
            Grid[0, 1] = new SourceGrid.Cells.ColumnHeader("HORA RECEPCION");
            Grid[0, 2] = new SourceGrid.Cells.ColumnHeader("DESCRIPCION");


            Grid.SelectionMode = SourceGrid.GridSelectionMode.Row;
            Grid.Columns.AutoSize(true);
        }
Esempio n. 42
0
        private void frmSample50_Load(object sender, EventArgs e)
        {
            grid1.BorderStyle = BorderStyle.FixedSingle;

            grid1.ColumnsCount = 3;
            grid1.FixedRows = 1;
            grid1.Rows.Insert(0);
            grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String");
            grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime");
            grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox");
            for (int r = 1; r < 100; r++)
            {
                grid1.Rows.Insert(r);
                grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string));
                grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime));
                grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true);
            }

            grid1.AutoSizeCells();
        }
Esempio n. 43
0
        public void SetupGrid()
        {
            SourceGrid.Cells.Views.Cell titleModel = new SourceGrid.Cells.Views.Cell
                                                         {
                                                             BackColor = Color.SteelBlue,
                                                             ForeColor = Color.White,
                                                             TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft
                                                         };

            this.Grid1.Columns.Clear();
            this.Grid1.Rows.Clear();

            this.Grid1.RowsCount = 1;
            this.Grid1.ColumnsCount = 2;
            this.Grid1.FixedRows = 1;
            this.Grid1.FixedColumns = 0;
            this.Grid1.Selection.EnableMultiSelection = false;

            this.Grid1.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.None;
            this.Grid1.Columns[0].Width = 80;

            this.Grid1.Columns[1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch;

            this.Grid1.AutoStretchColumnsToFitWidth = true;
            //Grid1->AutoSizeCells();
            this.Grid1.Columns.StretchToFit();

            //////////////////////////////////////////////////////////////////////
            // header row

            SourceGrid.Cells.ColumnHeader h;
            h = new SourceGrid.Cells.ColumnHeader("Name");
            h.AutomaticSortEnabled = false;
            this.Grid1[0, 0] = h;
            this.Grid1[0, 0].View = titleModel;

            h = new SourceGrid.Cells.ColumnHeader("URL");
            h.AutomaticSortEnabled = false;
            this.Grid1[0, 1] = h;
            this.Grid1[0, 1].View = titleModel;
        }
Esempio n. 44
0
        private void frmSample47_Load(object sender, EventArgs e)
        {
            grid1.BorderStyle = BorderStyle.FixedSingle;
            grid1.ColumnsCount = 3;
            grid1.FixedRows = 1;
            grid1.Rows.Insert(0);

            SourceGrid.Cells.ColumnHeader header1 = new SourceGrid.Cells.ColumnHeader("String");

            // here you can se the other column to sort when the current column is equal
            header1.SortComparer = new SourceGrid.MultiColumnsComparer(1, 2);

            grid1[0, 0] = header1;
            grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime");
            grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox");
            for (int r = 1; r < 10; r++)
            {
                grid1.Rows.Insert(r);
                grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string));
                grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today.AddDays(7 * r), typeof(DateTime));
                grid1[r, 2] = new SourceGrid.Cells.CheckBox("", true);
            }
            grid1.AutoSizeCells();
        }
        private void InitializeGrid()
        {
            // border
            DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1);
            DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border);

            // views
            CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White);
            viewNormal.Border = cellBorder;
            CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White);
            viewNormalCheck.Border = cellBorder;

            // column header view
            SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader();
            DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader();
            backHeader.BackColor = Color.LightGray;
            backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder;
            viewColumnHeader.Background = backHeader;
            viewColumnHeader.ForeColor = Color.Black;
            viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None;

            // row header view
            SourceGrid.Cells.Views.RowHeader viewRowHeader = new SourceGrid.Cells.Views.RowHeader();
            DevAge.Drawing.VisualElements.RowHeader backRowHeader = new DevAge.Drawing.VisualElements.RowHeader();
            backRowHeader.BackColor = Color.LightGray;
            backRowHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder;
            viewRowHeader.Background = backRowHeader;
            viewRowHeader.ForeColor = Color.Black;

            // create the grid
            gridDynamicBCT.BorderStyle = BorderStyle.FixedSingle;

            gridDynamicBCT.ColumnsCount = McKeeFormula.HumidityCoefDictionary.Count + 1;
            gridDynamicBCT.RowsCount = McKeeFormula.StockCoefDictionary.Count + 1;

            // column header
            SourceGrid.Cells.ColumnHeader columnHeader;
            int indexCol = 0;

            columnHeader = new SourceGrid.Cells.ColumnHeader("Humidity (%)/Storage");
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridDynamicBCT[0, indexCol++] = columnHeader;

            foreach (string key in McKeeFormula.HumidityCoefDictionary.Keys)
            {
                columnHeader = new SourceGrid.Cells.ColumnHeader(key);
                columnHeader.AutomaticSortEnabled = false;
                columnHeader.View = viewColumnHeader;
                gridDynamicBCT[0, indexCol++] = columnHeader;
            }

            SourceGrid.Cells.RowHeader rowHeader;
            int indexRow = 1;

            foreach (string key in McKeeFormula.StockCoefDictionary.Keys)
            {
                rowHeader = new SourceGrid.Cells.RowHeader(key);
                rowHeader.View = viewRowHeader;
                gridDynamicBCT[indexRow++, 0] = rowHeader;
            }

            gridDynamicBCT.AutoStretchColumnsToFitWidth = true;
            gridDynamicBCT.AutoSizeCells();
            gridDynamicBCT.Columns.StretchToFit();
        }
        private void FillGrid()
        {
            // fill grid solutions
            gridSolutions.Rows.Clear();
            // border
            DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1);
            DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border);
            // views
            CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White);
            viewNormal.Border = cellBorder;
            CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White);
            viewNormalCheck.Border = cellBorder;
            // column header view
            SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader();
            DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader();
            backHeader.BackColor = Color.LightGray;
            backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder;
            viewColumnHeader.Background = backHeader;
            viewColumnHeader.ForeColor = Color.White;
            viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold);
            viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None;
            // create the grid
            gridSolutions.BorderStyle = BorderStyle.FixedSingle;

            gridSolutions.ColumnsCount = 7;
            gridSolutions.FixedRows = 1;
            gridSolutions.Rows.Insert(0);
            // header
            SourceGrid.Cells.ColumnHeader columnHeader;
            // index
            columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_INDEX);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 0] = columnHeader;
            // layers
            columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_LAYERPATTERNS);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 1] = columnHeader;
            // case dimensions
            columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASE);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 2] = columnHeader;
            // box / case count
            columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_BOXCASECOUNT);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 3] = columnHeader;
            // efficiency
            columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_EFFICIENCYPERCENTAGE);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 4] = columnHeader;
            // weights
            columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Properties.Resources.ID_WEIGHT, UnitsManager.MassUnitString));
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 5] = columnHeader;
            // selected
            columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_SELECTED);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 6] = columnHeader;
            // handling check box click
            SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
            solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click);
            // data rows
            int iIndex = 0;
            foreach (BoxCasePalletSolution sol in _caseAnalysis.Solutions)
            {
                if (null == sol.PalletSolutionDesc.LoadPalletSolution())
                    continue;
                // insert new row
                gridSolutions.Rows.Insert(++iIndex);
                // # (index)
                gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(string.Format("{0}", iIndex));
                {
                    Graphics2DImage graphics = new Graphics2DImage(new Size(100, 50));
                    BoxCasePalletSolutionViewer sv = new BoxCasePalletSolutionViewer(sol);
                    sv.Draw(graphics);
                    // layers
                    gridSolutions[iIndex, 1] = new SourceGrid.Cells.Image(graphics.Bitmap);
                }
                // case dimensions
                gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "{0}\n({1:0.#}*{2:0.#}*{3:0.#})", sol.PalletSolutionDesc.FriendlyName, sol.CaseLength, sol.CaseWidth, sol.CaseHeight));
                // box / case count
                gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("Boxes/case: {0}\nCases/pallet: {1}\nBoxes/pallet:{2}", sol.BoxPerCaseCount, sol.CasePerPalletCount, sol.BoxPerPalletCount));
                // efficiency
                gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "Case :{0:0.#}\nPallet :{1:0.#}", sol.CaseEfficiency, sol.PalletEfficiency));
                // weights
                gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "Case :{0:0.#}\nPallet :{1:0.#}", sol.CaseWeight, sol.PalletWeight));
                // selected
                gridSolutions[iIndex, 6] = new SourceGrid.Cells.CheckBox(null, _caseAnalysis.HasSolutionSelected(iIndex - 1));

                gridSolutions[iIndex, 0].View = viewNormal;
                gridSolutions[iIndex, 1].View = viewNormal;
                gridSolutions[iIndex, 2].View = viewNormal;
                gridSolutions[iIndex, 3].View = viewNormal;
                gridSolutions[iIndex, 4].View = viewNormal;
                gridSolutions[iIndex, 5].View = viewNormal;
                gridSolutions[iIndex, 6].View = viewNormalCheck;

                gridSolutions[iIndex, 6].AddController(solCheckboxClickEvent);
            }
            try
            {
                gridSolutions.AutoStretchColumnsToFitWidth = true;
                gridSolutions.AutoSizeCells();
                gridSolutions.Columns.StretchToFit();
            }
            catch (Exception /*ex*/)
            { 
            }

            // select first solution
            gridSolutions.Selection.SelectRow(1, true);
            // draw
            graphCtrlCaseSolution.Invalidate();
            graphCtrlPalletSolution.Invalidate();
        }
Esempio n. 47
0
        /// <summary>
        /// 为SourceGrid绑定数据源
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="data"></param>
        public void BindSourceGrid(SourceGrid.Grid grid, DataTable data)
        {
            //byte[] imagebytes = null;

            int[] ColumnWidth = new int[] { 120, 100, 100 };
            //PopupMenu menuController = new PopupMenu();
            if (grid.RowsCount > 0)
            {
                //清除原表格内容
                grid.Rows.RemoveRange(0, grid.RowsCount);
            }
            //Redim grid
            //grid.Redim(data.Rows.Count + grid.FixedRows, data.Columns.Count);
            grid.SelectionMode = SourceGrid.GridSelectionMode.Row;//选行模式
            grid.Selection.EnableMultiSelection = false; //行不允许多选
            //grid.EnableSort = false; //不允许排序
            grid.BorderStyle = BorderStyle.FixedSingle;
            grid.ColumnsCount = 3;
            grid.FixedRows = 1;
            BuildGridColumnWidth(grid, ColumnWidth);
            grid.Rows.Insert(0);
            grid[0, 0] = new SourceGrid.Cells.ColumnHeader("用户名");
            grid[0, 1] = new SourceGrid.Cells.ColumnHeader("姓名");
            grid[0, 2] = new SourceGrid.Cells.ColumnHeader("用户角色");

            grid[0, 1].View.Font = new Font("宋体", 10, FontStyle.Bold);

            grid[0, 0].View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;

            for (int i = 1; i < data.Rows.Count + 1; i++)
            {
                grid.Rows.Insert(i);
                //设置行高
                grid.Rows.SetHeight(i, 30);

                #region 表体塞值

                //表体塞值
                grid[i, 0] = new SourceGrid.Cells.Cell(data.Rows[i - 1][0], typeof(string)); //用户名
                grid[i, 1] = new SourceGrid.Cells.Cell(data.Rows[i - 1][1], typeof(string));//姓名
                //grid[i, 2] = new SourceGrid.Cells.Cell(data.Rows[i - 1][2], typeof(string));//用户角色
                if (data.Rows[i - 1][2].ToString() == "0")
                {
                    grid[i, 2] = new SourceGrid.Cells.Cell("普通用户", typeof(string));
                }
                else if (data.Rows[i - 1][2].ToString() == "1")
                {
                    grid[i, 2] = new SourceGrid.Cells.Cell("管理员", typeof(string));
                }
                else
                {
                    grid[i, 2] = new SourceGrid.Cells.Cell("未知角色", typeof(string));
                }

                #endregion

                //设置单元格不可编辑
                grid[i, 0].Editor.EnableEdit = false;
                grid[i, 1].Editor.EnableEdit = false;
                grid[i, 2].Editor.EnableEdit = false;
            }
            grid.Refresh();
        }
Esempio n. 48
0
        private void LoadCategorySample(string category, SourceGrid.Cells.Controllers.Button linkEvents, Type[] assemblyTypes, SourceGrid.Cells.Views.IView categoryView, SourceGrid.Cells.Views.IView headerView)
        {
            int row;

            //Create Category Row
            row = grid1.RowsCount;
            grid1.Rows.Insert(row);
            grid1[row, 0] = new SourceGrid.Cells.Cell(category);
            grid1[row, 0].View = categoryView;
            grid1[row, 0].ColumnSpan = grid1.ColumnsCount;

            //Create Headers
            row = grid1.RowsCount;
            grid1.Rows.Insert(row);

            SourceGrid.Cells.ColumnHeader header1 = new SourceGrid.Cells.ColumnHeader("Sample N°");
            header1.View = headerView;
            header1.AutomaticSortEnabled = false;
            grid1[row, 0] = header1;

            SourceGrid.Cells.ColumnHeader header2 = new SourceGrid.Cells.ColumnHeader("Description");
            header2.View = headerView;
            header2.AutomaticSortEnabled = false;
            grid1[row, 1] = header2;

            //Create Data Cells
            for (int i = 0; i < assemblyTypes.Length; i++)
            {
                object[] attributes = assemblyTypes[i].GetCustomAttributes(typeof(SampleAttribute), true);
                if (attributes != null && attributes.Length > 0)
                {
                    SampleAttribute sampleAttribute = (SampleAttribute)attributes[0];

                    if (sampleAttribute.Category == category)
                    {
                        row = grid1.RowsCount;
                        grid1.Rows.Insert(row);
                        grid1[row, 0] = new SourceGrid.Cells.Cell( sampleAttribute.SampleNumber );
                        grid1[row, 0].View = new SourceGrid.Cells.Views.Cell();
                        grid1[row, 0].View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;

                        //Create a cell with a link
                        grid1[row, 1] = new SourceGrid.Cells.Link( sampleAttribute.Description );
                        grid1[row, 1].Tag = assemblyTypes[i];
                        grid1[row, 1].Controller.AddController(linkEvents);
                    }
                }
            }

            //Enable sorting of the category range
            SourceGrid.RangeLoader headerRange = new SourceGrid.RangeLoader(new SourceGrid.Range(header1.Range.Start.Row, 0, header1.Range.Start.Row, 1));
            SourceGrid.RangeLoader rangeToSort = new SourceGrid.RangeLoader(new SourceGrid.Range(header1.Range.Start.Row+1, 0, row, 1));
            SourceGrid.Cells.Controllers.SortableHeader sortableController = new SourceGrid.Cells.Controllers.SortableHeader(rangeToSort, headerRange);

            header1.AddController(sortableController);
            header1.Sort(true);
            header2.AddController(sortableController);
        }
        private void FillGrid()
        {
            // fill grid solutions
            gridSolutions.Rows.Clear();

            // border
            DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1);
            DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border);

            // views
            CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White);
            viewNormal.Border = cellBorder;
            CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White);
            viewNormalCheck.Border = cellBorder;

            // column header view
            SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader();
            DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader();
            backHeader.BackColor = Color.LightGray;
            backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder;
            viewColumnHeader.Background = backHeader;
            viewColumnHeader.ForeColor = Color.White;
            viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold);
            viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None;

            // create the grid
            gridSolutions.BorderStyle = BorderStyle.FixedSingle;

            gridSolutions.ColumnsCount = 7;
            gridSolutions.FixedRows = 1;
            gridSolutions.Rows.Insert(0);

            // header
            SourceGrid.Cells.ColumnHeader columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_INDEX);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 0] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LAYERPATTERN);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 1] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_BOXCOUNT);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 2] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_VOLUMEEFFICIENCY);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 3] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CASEWEIGHT);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 4] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CASELIMIT);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 5] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_SELECTED);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 6] = columnHeader;

            // handling check box click
            SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
            solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click);

            // data rows
            int iIndex = 0;
            foreach (BoxCaseSolution sol in _analysis.Solutions)
            {
                // build case count string
                string sBoxCount = string.Empty;
                sBoxCount = string.Format("{0}\n({1} * {2})", sol.BoxPerCaseCount, sol.BoxPerLayerCount, sol.Count);
                // insert row
                gridSolutions.Rows.Insert(++iIndex);
                // filling columns
                gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(string.Format("{0}", iIndex));
                {
                    Graphics2DImage graphics = new Graphics2DImage(new Size(50, 50));
                    BoxCaseSolutionViewer sv = new BoxCaseSolutionViewer(sol);
                    sv.Draw(graphics);
                    gridSolutions[iIndex, 1] = new SourceGrid.Cells.Image(graphics.Bitmap);
                }
                gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(sBoxCount);
                gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.VolumeEfficiencyBoxes));
                gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.CaseWeight));
                gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(BoxCaseSolutionLimitToString(sol.LimitReached));
                gridSolutions[iIndex, 6] = new SourceGrid.Cells.CheckBox(null, _analysis.HasSolutionSelected(iIndex - 1));

                gridSolutions[iIndex, 6].AddController(solCheckboxClickEvent);
            }

            gridSolutions.AutoStretchColumnsToFitWidth = true;
            gridSolutions.AutoSizeCells();
            gridSolutions.Columns.StretchToFit();

            // select first solution
            gridSolutions.Selection.SelectRow(1, true);
            // redraw
            graphCtrlSolution.Invalidate();
        }
        private void FillGrid()
        {
            // fill grid solutions
            gridSolutions.Rows.Clear();

            // border
            DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1);
            DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border);

            // views
            CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White);
            viewNormal.Border = cellBorder;

            // column header view
            SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader();
            DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader();
            backHeader.BackColor = Color.LightGray;
            backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder;
            viewColumnHeader.Background = backHeader;
            viewColumnHeader.ForeColor = Color.White;
            viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold);
            viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None;

            // create the grid
            gridSolutions.BorderStyle = BorderStyle.FixedSingle;

            gridSolutions.ColumnsCount = 5;
            gridSolutions.FixedRows = 1;
            gridSolutions.Rows.Insert(0);

            // header
            SourceGrid.Cells.ColumnHeader columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_INDEX);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 0] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LAYERPATTERN);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 1] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_BUNDLECOUNT);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 2] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_VOLUMEEFFICIENCY);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 3] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_PALLETWEIGHT);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 4] = columnHeader;

            // data rows
            int iIndex = 0;
            foreach (CasePalletSolution sol in _analysis.Solutions)
            {
                // build case count string
                string sBoxCount = string.Empty;
                sBoxCount = string.Format("{0}\n({1} * {2})", sol.CaseCount, sol.CasePerLayerCount, sol.Count);
                // insert row
                gridSolutions.Rows.Insert(++iIndex);
                // filling columns
                gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(string.Format("{0}", iIndex));
                {
                    Graphics2DImage graphics = new Graphics2DImage(new Size(80, 40));
                    CasePalletSolutionViewer sv = new CasePalletSolutionViewer(sol);
                    sv.Draw(graphics);
                    gridSolutions[iIndex, 1] = new SourceGrid.Cells.Image(graphics.Bitmap);
                }
                gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(sBoxCount);
                gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.VolumeEfficiencyCases));
                gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.PalletWeight));

                gridSolutions[iIndex, 0].View = viewNormal;
                gridSolutions[iIndex, 1].View = viewNormal;
                gridSolutions[iIndex, 2].View = viewNormal;
                gridSolutions[iIndex, 3].View = viewNormal;
                gridSolutions[iIndex, 4].View = viewNormal;
            }

            gridSolutions.AutoStretchColumnsToFitWidth = true;
            gridSolutions.AutoSizeCells();
            gridSolutions.Columns.StretchToFit();

            // select first solution
            gridSolutions.Selection.SelectRow(1, true);
            // redraw
            graphCtrlSolution.Invalidate();
        }
Esempio n. 51
0
		private void frmSample17_Load(object sender, System.EventArgs e)
		{
			grid1.Redim(40,40);
            grid1.FixedColumns = 1;
            grid1.FixedRows = 1;

			grid1[0,0] = new SourceGrid.Cells.Header(null);
			for (int c = 1; c < grid1.ColumnsCount; c++)
			{
				SourceGrid.Cells.ColumnHeader header = new SourceGrid.Cells.ColumnHeader("Header " + c.ToString());
                header.AutomaticSortEnabled = false;

                //header.ColumnSelectorEnabled = true;
                //header.ColumnFocusEnabled = true;

                grid1[0, c] = header;
			}

			Random rnd = new Random();
			for (int r = 1; r < grid1.RowsCount; r++)
			{
				grid1[r,0] = new SourceGrid.Cells.RowHeader("Header " + r.ToString());
				for (int c = 1; c < grid1.ColumnsCount; c++)
				{
					if (rnd.NextDouble() > 0.20)
					{
						grid1[r,c] = new SourceGrid.Cells.Cell(r*c, typeof(int));
					}
					else
						grid1[r,c] = null;
				}
			}

			cPickSelBackColor.SelectedColor = Color.FromArgb(grid1.Selection.BackColor.R, grid1.Selection.BackColor.G, grid1.Selection.BackColor.B);
			cPckBorderColor.SelectedColor = grid1.Selection.Border.Top.Color;
			trackSelectionAlpha.Value = (int)grid1.Selection.BackColor.A;
			trackBorderWidth.Value = (int)grid1.Selection.Border.Top.Width;

			cPickFocusBackColor.SelectedColor = Color.FromArgb(grid1.Selection.FocusBackColor.R, grid1.Selection.FocusBackColor.G, grid1.Selection.FocusBackColor.B);
			trackFocusBackColorTrans.Value = grid1.Selection.FocusBackColor.A;


			this.cPickSelBackColor.SelectedColorChanged += new System.EventHandler(this.cPickSelBackColor_SelectedColorChanged);
			this.cPckBorderColor.SelectedColorChanged += new System.EventHandler(this.cPckBorderColor_SelectedColorChanged);
			this.trackSelectionAlpha.ValueChanged += new System.EventHandler(this.trackSelectionAlpha_ValueChanged);
			this.trackBorderWidth.ValueChanged += new System.EventHandler(this.trackBorderWidth_ValueChanged);
			this.trackFocusBackColorTrans.ValueChanged += new System.EventHandler(this.trackFocusBackColorTrans_ValueChanged);
			this.cPickFocusBackColor.SelectedColorChanged += new System.EventHandler(this.cPickFocusBackColor_SelectedColorChanged);

			cbDashStyle.Validator = new DevAge.ComponentModel.Validator.ValidatorTypeConverter(typeof(System.Drawing.Drawing2D.DashStyle));
			cbDashStyle.Value = grid1.Selection.Border.Top.DashStyle;
		}
Esempio n. 52
0
		private void Form1_Load(object sender, System.EventArgs e)
		{
			grid1.Redim(10, 5);

            //Setup the controllers
			CellClickEvent clickController = new CellClickEvent();
			PopupMenu menuController = new PopupMenu();
			CellCursor cursorController = new CellCursor();
            SourceGrid.Cells.Controllers.ToolTipText toolTipController = new SourceGrid.Cells.Controllers.ToolTipText();
            toolTipController.ToolTipTitle = "ToolTip example";
            toolTipController.ToolTipIcon = ToolTipIcon.Info;
            toolTipController.IsBalloon = true;
            ValueChangedEvent valueChangedController = new ValueChangedEvent();
            
			for (int r = 0; r < grid1.Rows.Count; r++)
			{
				if (r == 0)
				{
					grid1[r, 0] = new SourceGrid.Cells.ColumnHeader("Click event");
					grid1[r, 1] = new SourceGrid.Cells.ColumnHeader("Custom Cursor");
					grid1[r, 2] = new SourceGrid.Cells.ColumnHeader("ContextMenu");
                    grid1[r, 3] = new SourceGrid.Cells.ColumnHeader("ToolTip");
                    grid1[r, 4] = new SourceGrid.Cells.ColumnHeader("ValueChanged");
                }
				else
				{
					grid1[r, 0] = new SourceGrid.Cells.Cell("Value " + r.ToString(), typeof(string));
					grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Now, typeof(DateTime));
					grid1[r, 2] = new SourceGrid.Cells.Cell("Right click");
                    grid1[r, 3] = new SourceGrid.Cells.Cell("Value " + r.ToString());
                    grid1[r, 3].ToolTipText = "Example of tooltip, bla bla bla ....\n Row: " + r.ToString();
                    grid1[r, 4] = new SourceGrid.Cells.Cell("Value " + r.ToString(), typeof(string));
                }

				grid1[r, 0].AddController(clickController);
				grid1[r, 1].AddController(cursorController);
				grid1[r, 2].AddController(menuController);
                grid1[r, 3].AddController(toolTipController);
                grid1[r, 4].AddController(valueChangedController);
			}

            grid1.AutoSizeCells();

            //Add the key controller to all the cells
            grid1.Controller.AddController(new KeyEvent(this));
		}
Esempio n. 53
0
        private void FillGrid()
        {
            // fill grid solution
            gridSolutions.Rows.Clear();

            // border
            DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1);
            DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border);

            // views
            CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White);
            viewNormal.Border = cellBorder;
            CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White);
            viewNormalCheck.Border = cellBorder;

            // column header view
            SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader();
            DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader();
            backHeader.BackColor = Color.LightGray;
            backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder;
            viewColumnHeader.Background = backHeader;
            viewColumnHeader.ForeColor = Color.White;
            viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold);
            viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None;

            // create the grid
            gridSolutions.BorderStyle = BorderStyle.FixedSingle;

            gridSolutions.ColumnsCount = 7;
            gridSolutions.FixedRows = 1;
            gridSolutions.Rows.Insert(0);

            // header
            SourceGrid.Cells.ColumnHeader columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASE);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 0] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_NAME);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 1] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASEDIMENSIONS + @" (mm*mm*mm)");
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 2] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASEINSIDEDIMENSIONS + @" (mm*mm*mm)");
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 3] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_ORIENTATION);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 4] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASECOUNT);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 5] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_SELECTED);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 6] = columnHeader;

            // handling check box click
            SourceGrid.Cells.Controllers.CustomEvents palletSolCheckBoxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
            palletSolCheckBoxClickEvent.Click += new EventHandler(palletSolCheckBoxClickEvent_Click);
            int iIndex = 0;
            foreach (PalletSolutionDesc desc in PalletSolutionDatabase.Instance.QueryPalletSolutions(CurrentKey))
            {
                gridSolutions.Rows.Insert(++iIndex);
                gridSolutions[iIndex, 0] = new SourceGrid.Cells.Image(GetBoxBitmapFromDesc(desc));
                gridSolutions[iIndex, 1] = new SourceGrid.Cells.Cell(desc.FriendlyName);
                gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseDimensionsString));
                gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseInsideDimensionsString));
                gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseOrientation));
                gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseCount));
                bool selected = true;
                if (null != _caseAnalysis)
                    selected = _caseAnalysis.PalletSolutionsList.Contains(desc);
                gridSolutions[iIndex, 6] = new SourceGrid.Cells.CheckBox(null, selected);
                gridSolutions[iIndex, 6].AddController(palletSolCheckBoxClickEvent);
            }

            // handling check box click
            SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents();

            gridSolutions.AutoStretchColumnsToFitWidth = true;
            gridSolutions.AutoSizeCells();
            gridSolutions.Columns.StretchToFit();

            // select first solution
            gridSolutions.Selection.SelectRow(-1, false);
        }
Esempio n. 54
0
        private void btLoad_Click(object sender, System.EventArgs e)
        {
            grid.Redim(0, 0);
            //Visual properties shared between all the cells
            SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
            view.BackColor = Color.Snow;

            //Editor (IDataModel) shared between all the cells
            SourceGrid.Cells.Editors.TextBox editor = new
            SourceGrid.Cells.Editors.TextBox(typeof(string));

            grid.Redim(int.Parse(txtRows.Text), int.Parse(txtCols.Text));

            if (chkAddHeaders.Checked && grid.RowsCount > 0 &&
                        grid.ColumnsCount > 0)
            {
                grid.FixedRows = 1;
                grid.FixedColumns = 1;

                for (int r = grid.FixedRows; r < grid.RowsCount; r++)
                    grid[r, 0] = new SourceGrid.Cells.RowHeader(r);
                for (int c = grid.FixedColumns; c < grid.ColumnsCount; c++)
                {
                    SourceGrid.Cells.ColumnHeader header = new
                    SourceGrid.Cells.ColumnHeader(c);
                    header.AutomaticSortEnabled = false;
                    grid[0, c] = header;
                }
                grid[0, 0] = new SourceGrid.Cells.Header();
            }
            else
            {
                grid.FixedRows = 0;
                grid.FixedColumns = 0;
            }

            for (int r = grid.FixedRows; r < grid.RowsCount; r++)
                for (int c = grid.FixedColumns; c < grid.ColumnsCount; c++)
                {
                    grid[r, c] = new SourceGrid.Cells.Cell(r.ToString() + "," +
                    c.ToString());
                    grid[r, c].Editor = editor;
                    grid[r, c].View = view;
                }
            grid.Selection.Focus(new SourceGrid.Position(0, 0), true);
        }
        private void FillGrid()
        {
            // fill grid solution
            gridSolutions.Rows.Clear();

            // border
            DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1);
            DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border);

            // views
            CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White);
            viewNormal.Border = cellBorder;
            CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White);
            viewNormalCheck.Border = cellBorder;

            // column header view
            SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader();
            DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader();
            backHeader.BackColor = Color.LightGray;
            backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder;
            viewColumnHeader.Background = backHeader;
            viewColumnHeader.ForeColor = Color.White;
            viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold);
            viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None;

            // create the grid
            gridSolutions.BorderStyle = BorderStyle.FixedSingle;

            gridSolutions.ColumnsCount = 6;
            gridSolutions.FixedRows = 1;
            gridSolutions.Rows.Insert(0);

            // header
            SourceGrid.Cells.ColumnHeader columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_INDEX);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 0] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CYLINDERCOUNT);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 1] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETWEIGHT, UnitsManager.MassUnitString));
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 2] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETHEIGHT, UnitsManager.LengthUnitString));
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 3] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_PALLETLIMIT);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 4] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_SELECTED);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 5] = columnHeader;

            // handling check box click
            SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
            solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click);

            // data rows
            int iIndex = 0;
            foreach (HCylinderPalletSolution sol in _analysis.Solutions)
            {
                // build case count string
                string sCaseCount = string.Format("{0}", sol.CylinderCount);
                // insert row
                gridSolutions.Rows.Insert(++iIndex);
                // filling columns
                gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(string.Format("{0}", iIndex));
                gridSolutions[iIndex, 1] = new SourceGrid.Cells.Cell(sCaseCount);
                gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.PalletWeight));
                gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.PalletHeight));
                gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(PalletSolutionLimitToString(sol.LimitReached));
                gridSolutions[iIndex, 5] = new SourceGrid.Cells.CheckBox(null, _analysis.HasSolutionSelected(iIndex - 1));

                gridSolutions[iIndex, 0].View = viewNormal;
                gridSolutions[iIndex, 1].View = viewNormal;
                gridSolutions[iIndex, 2].View = viewNormal;
                gridSolutions[iIndex, 3].View = viewNormal;
                gridSolutions[iIndex, 4].View = viewNormal;
                gridSolutions[iIndex, 5].View = viewNormalCheck;

                gridSolutions[iIndex, 5].AddController(solCheckboxClickEvent);
            }
            gridSolutions.AutoStretchColumnsToFitWidth = true;
            gridSolutions.AutoSizeCells();
            gridSolutions.Columns.StretchToFit();

            // select first solution
            gridSolutions.Selection.SelectRow(1, true);
            graphCtrlSolution.Invalidate();
        }
        private void FillGrid()
        {
            try
            {
                // fill grid solution
                gridSolutions.Rows.Clear();

                // border
                DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1);
                DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border);

                // views
                CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White);
                viewNormal.Border = cellBorder;
                CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White);
                viewNormalCheck.Border = cellBorder;

                // column header view
                SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader();
                DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader();
                backHeader.BackColor = Color.LightGray;
                backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder;
                viewColumnHeader.Background = backHeader;
                viewColumnHeader.ForeColor = Color.White;
                viewColumnHeader.Font = new Font("Arial", 8, FontStyle.Regular);
                viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None;

                // create the grid
                gridSolutions.BorderStyle = BorderStyle.FixedSingle;

                gridSolutions.ColumnsCount = 12;
                gridSolutions.FixedRows = 1;
                gridSolutions.Rows.Insert(0);

                // header
                SourceGrid.Cells.ColumnHeader columnHeader;
                // 0
                columnHeader = new SourceGrid.Cells.ColumnHeader("#");
                columnHeader.AutomaticSortEnabled = false;
                columnHeader.View = viewColumnHeader;
                gridSolutions[0, 0] = columnHeader;
                // 1
                columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_A1);
                columnHeader.AutomaticSortEnabled = false;
                columnHeader.View = viewColumnHeader;
                gridSolutions[0, 1] = columnHeader;
                // 2
                columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_A2);
                columnHeader.AutomaticSortEnabled = false;
                columnHeader.View = viewColumnHeader;
                gridSolutions[0, 2] = columnHeader;
                // 3
                columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_A3);
                columnHeader.AutomaticSortEnabled = false;
                columnHeader.View = viewColumnHeader;
                gridSolutions[0, 3] = columnHeader;
                // 4
                columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LENGTH);
                columnHeader.AutomaticSortEnabled = false;
                columnHeader.View = viewColumnHeader;
                gridSolutions[0, 4] = columnHeader;
                // 5
                columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_WIDTH);
                columnHeader.AutomaticSortEnabled = false;
                columnHeader.View = viewColumnHeader;
                gridSolutions[0, 5] = columnHeader;
                // 6
                columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_HEIGHT);
                columnHeader.AutomaticSortEnabled = false;
                columnHeader.View = viewColumnHeader;
                gridSolutions[0, 6] = columnHeader;
                // 7
                columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_AREA);
                columnHeader.AutomaticSortEnabled = false;
                columnHeader.View = viewColumnHeader;
                gridSolutions[0, 7] = columnHeader;
                // 8
                columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CASESLAYER);
                columnHeader.AutomaticSortEnabled = false;
                columnHeader.View = viewColumnHeader;
                gridSolutions[0, 8] = columnHeader;
                // 9
                columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LAYERS);
                columnHeader.AutomaticSortEnabled = false;
                columnHeader.View = viewColumnHeader;
                gridSolutions[0, 9] = columnHeader;
                // 10
                columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CASESPALLET);
                columnHeader.AutomaticSortEnabled = false;
                columnHeader.View = viewColumnHeader;
                gridSolutions[0, 10] = columnHeader;
                // 11
                columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_VOLUMEEFFICIENCY);
                columnHeader.AutomaticSortEnabled = false;
                columnHeader.View = viewColumnHeader;
                gridSolutions[0, 11] = columnHeader;

                // column width
                gridSolutions.Columns[0].Width = 30;
                gridSolutions.Columns[1].Width = 30;
                gridSolutions.Columns[2].Width = 30;
                gridSolutions.Columns[3].Width = 30;
                gridSolutions.Columns[4].Width = 50;
                gridSolutions.Columns[5].Width = 50;
                gridSolutions.Columns[6].Width = 50;
                gridSolutions.Columns[7].Width = 50;
                gridSolutions.Columns[8].Width = 80;
                gridSolutions.Columns[9].Width = 50;
                gridSolutions.Columns[10].Width = 80;
                gridSolutions.Columns[11].Width = 100;

                // get BoxProperties
                BoxProperties boxProperties = SelectedBox;
                PalletProperties palletProperties = SelectedPallet;
                CaseOptimConstraintSet caseOptimConstraintSet = BuildCaseOptimConstraintSet();
                PalletConstraintSet palletConstraintSet = new CasePalletConstraintSet();
                palletConstraintSet.MaximumHeight = (double)nudPalletHeight.Value;
                // data
                int iIndex = 0;
                foreach (CaseOptimSolution sol in _solutions)
                {
                    // insert new row
                    gridSolutions.Rows.Insert(++iIndex);
                    // # (index)
                    gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(string.Format("{0}", iIndex));
                    // A1
                    gridSolutions[iIndex, 1] = new SourceGrid.Cells.Cell(string.Format("{0}", sol.CaseDefinition.Arrangement._iLength));
                    // A2
                    gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(string.Format("{0}", sol.CaseDefinition.Arrangement._iWidth));
                    // A3
                    gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0}", sol.CaseDefinition.Arrangement._iHeight));
                    // Case inner dimensions
                    Vector3D innerDim = sol.CaseDefinition.InnerDimensions(boxProperties);
                    // LENGTH
                    gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format("{0:0.#}", innerDim.X));
                    // WIDTH
                    gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(string.Format("{0:0.#}", innerDim.Y));
                    // HEIGHT
                    gridSolutions[iIndex, 6] = new SourceGrid.Cells.Cell(string.Format("{0:0.#}", innerDim.Z));
                    // AREA
                    gridSolutions[iIndex, 7] = new SourceGrid.Cells.Cell(string.Format("{0:0.00}", sol.CaseDefinition.Area(boxProperties, caseOptimConstraintSet) * 1.0E-06));
                    // CASES PER LAYER
                    gridSolutions[iIndex, 8] = new SourceGrid.Cells.Cell(string.Format("{0}", sol.PalletSolution[0].BoxCount));
                    // LAYERS
                    gridSolutions[iIndex, 9] = new SourceGrid.Cells.Cell(string.Format("{0}", sol.PalletSolution.Count));
                    // CASES PER PALLET
                    gridSolutions[iIndex, 10] = new SourceGrid.Cells.Cell(string.Format("{0}", sol.CaseCount));
                    // EFFICIENCY
                    double efficiency = sol.CaseCount * sol.CaseDefinition.InnerVolume(boxProperties) /
                        ((palletProperties.Length - palletConstraintSet.OverhangX)
                        * (palletProperties.Width - palletConstraintSet.OverhangY)
                        * (palletConstraintSet.MaximumHeight - palletProperties.Height)
                        );
                    gridSolutions[iIndex, 11] = new SourceGrid.Cells.Cell(string.Format("{0:0.00}", efficiency));
                }
                // select first solution
                if (_solutions.Count > 0)
                {
                    gridSolutions.Selection.EnableMultiSelection = false;
                    gridSolutions.Selection.SelectRow(1, true);
                }
            }
            catch (Exception ex)
            {   _log.Error(ex.ToString()); }

            graphCtrlBoxesLayout.Invalidate();
            graphCtrlPalletLayout.Invalidate();
            UpdateToolbarButtons();
        }
        private void FillGrid()
        {
            // fill grid solution
            gridSolutions.Rows.Clear();

            // border
            DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1);
            DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border);

            // views
            CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White);
            viewNormal.Border = cellBorder;
            CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White);
            viewNormalCheck.Border = cellBorder;

            // column header view
            SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader();
            DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader();
            backHeader.BackColor = Color.LightGray;
            backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder;
            viewColumnHeader.Background = backHeader;
            viewColumnHeader.ForeColor = Color.White;
            viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold);
            viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None;

            // create the grid
            gridSolutions.BorderStyle = BorderStyle.FixedSingle;

            gridSolutions.ColumnsCount = 8;
            gridSolutions.FixedRows = 1;
            gridSolutions.Rows.Insert(0);

            // header
            SourceGrid.Cells.ColumnHeader columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LAYERPATTERN);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 0] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_PACKCOUNT);
            columnHeader.AutomaticSortEnabled = false;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 1] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CONSUMERSALESUNITS);
            columnHeader.AutomaticSortEnabled = true;
            columnHeader.View = viewColumnHeader;
            columnHeader.SortComparer = new SourceGrid.MultiColumnsComparer();
            gridSolutions[0, 2] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_LAYERWEIGHT, UnitsManager.MassUnitString));
            columnHeader.AutomaticSortEnabled = true;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 3] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETWEIGHT, UnitsManager.MassUnitString));
            columnHeader.AutomaticSortEnabled = true;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 4] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETHEIGHT, UnitsManager.LengthUnitString));
            columnHeader.AutomaticSortEnabled = true;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 5] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_MAXIMUMSPACE, UnitsManager.LengthUnitString));
            columnHeader.AutomaticSortEnabled = true;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 6] = columnHeader;

            columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_SELECTED);
            columnHeader.AutomaticSortEnabled = true;
            columnHeader.View = viewColumnHeader;
            gridSolutions[0, 7] = columnHeader;

            // handling check box click
            SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
            solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click);

            // data rows
            int iIndex = 0;
            foreach (PackPalletSolution sol in _analysis.Solutions)
            {
                // build case count string
                string sPackCount = string.Format("{0}\n({1} * {2})", sol.PackCount, sol.PackPerLayer, sol.LayerCount);
                string sCSUCount = string.Format("{0}", sol.CSUCount);
                // insert row
                gridSolutions.Rows.Insert(++iIndex);
                gridSolutions.Rows[iIndex].Tag = sol;

                // filling columns
                {
                    Graphics2DImage graphics = new Graphics2DImage(new Size(100, 50));
                    PackPalletSolutionViewer sv = new PackPalletSolutionViewer(sol);
                    sv.Draw(graphics);
                    gridSolutions[iIndex, 0] = new SourceGrid.Cells.Image(graphics.Bitmap);
                }
                gridSolutions[iIndex, 1] = new SourceGrid.Cells.Cell(sPackCount);
                gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(sCSUCount);
                gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(Math.Round(sol.LayerWeight, 3));
                gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(Math.Round(sol.PalletWeight, 3));
                gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(Math.Round(sol.PalletHeight, 1));
                gridSolutions[iIndex, 6] = new SourceGrid.Cells.Cell(Math.Round(sol.MaximumSpace, 1));
                gridSolutions[iIndex, 7] = new SourceGrid.Cells.CheckBox(null, _analysis.HasSolutionSelected(iIndex - 1));

                gridSolutions[iIndex, 0].View = viewNormal;
                gridSolutions[iIndex, 1].View = viewNormal;
                gridSolutions[iIndex, 2].View = viewNormal;
                gridSolutions[iIndex, 3].View = viewNormal;
                gridSolutions[iIndex, 4].View = viewNormal;
                gridSolutions[iIndex, 5].View = viewNormal;
                gridSolutions[iIndex, 6].View = viewNormal;
                gridSolutions[iIndex, 7].View = viewNormalCheck;

                gridSolutions[iIndex, 7].AddController(solCheckboxClickEvent);
            }
            gridSolutions.AutoStretchColumnsToFitWidth = true;
            gridSolutions.AutoSizeCells();
            gridSolutions.Columns.StretchToFit();

            // select first solution
            gridSolutions.Selection.SelectRow(1, true);
            graphCtrlSolution.Invalidate();
        }
 private void initAdminGridColumn()
 {
     this.adminGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
     this.adminGrid.Rows.Clear();
     this.adminGrid.SuspendLayout();
     this.adminGrid.ColumnsCount = this.columnInfos.Length;
     this.adminGrid.FixedRows = 1;
     SourceGrid.Cells.ColumnHeader columnHeader;
     this.adminGrid.Rows.Insert(0);
     for (int i = 0; i < this.columnInfos.Length; i++)
     {
         columnHeader = new SourceGrid.Cells.ColumnHeader(columnInfos[i].ColumnName);
         columnHeader.View = viewColumnHeader1;
         this.adminGrid[0, i] = columnHeader;
     }
     this.adminGrid.ResumeLayout();
     this.adminGrid.AutoSizeCells();
 }
Esempio n. 59
0
		private void frmSample25_Load(object sender, System.EventArgs e)
		{
			grid.Redim(1, 3);

            grid.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
            grid.Columns[1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
            grid.Columns[2].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize | SourceGrid.AutoSizeMode.EnableStretch;

            grid.FixedRows = 1;

			grid[0, 0] = new SourceGrid.Cells.ColumnHeader("Date");
			grid[0, 1] = new SourceGrid.Cells.ColumnHeader("Type");
			grid[0, 2] = new SourceGrid.Cells.ColumnHeader("Description");

			grid.AutoStretchColumnsToFitWidth = true;
			grid.SelectionMode = SourceGrid.GridSelectionMode.Row;

			AddLog("Log", "Application Started");


			//Create Data Cells
			System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
			Type[] assemblyTypes = assembly.GetTypes();
			for (int i = 0; i < assemblyTypes.Length; i++)
			{
				object[] attributes = assemblyTypes[i].GetCustomAttributes(typeof(SampleAttribute), true);
				if (attributes != null && attributes.Length > 0)
				{
					SampleAttribute sampleAttribute = (SampleAttribute)attributes[0];

					AddLog("Log Menu", "Add menu for " + sampleAttribute.Description + " " + assemblyTypes[i].Name);

					if (assemblyTypes[i] != this.GetType())
					{
						MenuItem menu = new MenuForm(this, assemblyTypes[i], sampleAttribute.Description + " " + sampleAttribute.SampleNumber.ToString());
						mnWindow.MenuItems.Add(menu);
					}
				}
			}

            for (int i = 0; i < 200; i++)
                AddLog("Log", "Application test " + i.ToString());

            grid.Columns.AutoSize(true);
            grid.Columns.StretchToFit();
        }
Esempio n. 60
0
		private void frmSample14_Load(object sender, System.EventArgs e)
		{
			grid1.BorderStyle = BorderStyle.FixedSingle;

			grid1.ColumnsCount = 4;
			grid1.FixedRows = 1;
			grid1.Rows.Insert(0);

            SourceGrid.Cells.Editors.ComboBox cbEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(string));
            cbEditor.StandardValues = new string[]{"Value 1", "Value 2", "Value 3"};
            cbEditor.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.SingleClick | SourceGrid.EditableMode.AnyKey;

			grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String");
			grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime");
			grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox");
            grid1[0, 3] = new SourceGrid.Cells.ColumnHeader("ComboBox");
            for (int r = 1; r < 10; r++)
			{
				grid1.Rows.Insert(r);
				grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string));
				grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime));
				grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true);
                grid1[r, 3] = new SourceGrid.Cells.Cell("Value 1", cbEditor);
                grid1[r, 3].View = SourceGrid.Cells.Views.ComboBox.Default;
            }

            grid1.AutoSizeCells();
		}