protected override void OnValidated(EventArgs e)
        {
            if (dataGridView is ExtendedDataGridView)
            {
                ExtendedDataGridView edgw = dataGridView as ExtendedDataGridView;

                // edgw.ControlValidate(SL[TextBox1.Text]);
            }
            base.OnValidated(e);
        }
예제 #2
0
 public GridViewForm(params string[] fields)
 {
     InitializeComponent();
     grid = new ExtendedDataGridView();
     for (int i = 0; i < fields.Length; i++)
         grid.Columns.Add(fields[i], Char.ToUpper(fields[i][0]) + fields[i].Substring(1));
     grid.AllowUserToAddRows = false;
     grid.ReadOnly = true;
     grid.AllowDrop = false;
     grid.ScrollBars = ScrollBars.Vertical;
     this.Width = 500;
     this.Height = 500;
     resize(this, new EventArgs());
     this.Controls.Add(grid);
     this.Text = "Students";
     this.Show();
     this.Resize += resize;
 }
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="dataGridView">DataGridView with which this ToolStrip will be associated.</param>
		public ExtendedToolStrip(ExtendedDataGridView dataGridView) : this()
		{
			this.DataGridView = dataGridView;
		}
예제 #4
0
 private void insertGridViews()
 {
     addControl((subjects = new ExtendedDataGridView()), 0, 7, AnchorStyles.None, 6);
     subjects.Columns.Add("subject", "Subject");
     subjects.AllowUserToAddRows = false;
 }
예제 #5
0
 private void insertStatusConsole()
 {
     addControl((subjects = new ExtendedDataGridView()), 1, 6, AnchorStyles.None);
     layout.SetRowSpan(subjects, 2);
 }
예제 #6
0
        public static void AddTableControls(FormMain parent, ToolStripMenuItem menu, ExtendedDataGridView dataGridView, BindingSource bindingSource)
        {
            menu.DropDownItems.Add(Decorator.CreateCheckboxToolStrip(true, "Header", isVisible => dataGridView.HeaderVisible        = isVisible));
            menu.DropDownItems.Add(Decorator.CreateCheckboxToolStrip(true, "Footer", isVisible => dataGridView.FooterVisible        = isVisible));
            menu.DropDownItems.Add(Decorator.CreateCheckboxToolStrip(false, "Selector", isVisible => dataGridView.RowHeadersVisible = isVisible));
            menu.DropDownItems.Add(Decorator.CreateCheckboxToolStrip(true, "Multiline", isEnabled => dataGridView.Multiline         = isEnabled));

            menu.DropDownItems.Add(Decorator.CreateButtonToolStrip("Data Format", (sender, args) =>
            {
                DataGridView grid       = new DataGridView();
                grid.Dock               = DockStyle.Fill;
                grid.AllowUserToAddRows = false;
                grid.RowHeadersVisible  = false;
                grid.RowTemplate.DefaultCellStyle.Padding = new Padding(3, 5, 3, 5);
                grid.ColumnHeadersHeight += 10;
                grid.RowTemplate.Height  += 10;

                grid.Columns.Add(new DataGridViewColumn {
                    Name = "№", CellTemplate = new DataGridViewTextBoxCell(), Width = 80, ReadOnly = true
                });
                grid.Columns.Add(new DataGridViewColumn {
                    Name = "Type", CellTemplate = new DataGridViewTextBoxCell(), Width = 150, ReadOnly = true
                });
                grid.Columns.Add(new DataGridViewColumn
                {
                    Name             = "Format (Editable)",
                    CellTemplate     = new DataGridViewTextBoxCell(),
                    Width            = 300,
                    DefaultCellStyle = new DataGridViewCellStyle
                    {
                        NullValue = "[NULL]"
                    }
                });

                int index = 0;
                foreach (var column in parent.Columns)
                {
                    grid.Rows.Add(++index, column.type.Name, column.Format);
                }

                grid.CellValueChanged += (o, ev) => parent.Columns[ev.RowIndex].Format = grid.Rows[ev.RowIndex].Cells[ev.ColumnIndex].Value.ToString();

                Form dialog          = new Form();
                dialog.Text          = "Data rows format";
                dialog.Size          = new Size(400, 200);
                dialog.MinimizeBox   = false;
                dialog.MaximizeBox   = false;
                dialog.StartPosition = FormStartPosition.CenterParent;
                dialog.AutoScaleMode = AutoScaleMode.Font;
                dialog.Font          = parent.Font;

                dialog.Controls.Add(grid);
                dialog.Show(parent);
            }));

            menu.DropDownItems.Add(Decorator.CreateButtonToolStrip("Config Folder", (sender, args) =>
            {
                var fullFilePath = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath;
                Process.Start("explorer.exe", Path.GetDirectoryName(fullFilePath));
            }));
        }