public PinForm(GridForm ParentForm, bool BShowRetries) { InitializeComponent(); prntForm = ParentForm; label1.Visible = BShowRetries; bShowRetries = BShowRetries; }
public GridTabClass(GridForm ClassParent, TabControl ParentTabControl, string TabTitle) : base() { parentTabControl = ParentTabControl; parentTabControl.TabPages.Add(this); classParent = ClassParent; this.Text = TabTitle; gridTabName = TabTitle; // Data Grid tabGrid = new DataGridView(); tabGrid.Name = "grd_" + TabTitle; tabGrid.Dock = DockStyle.Fill; tabGrid.Parent = this; tabGrid.AllowUserToAddRows = false; tabGrid.RowValidating += Grid_RowValidating; tabGrid.CellEnter += tabGrid_CellEnter; tabGrid.CellBeginEdit += tabGrid_CellBeginEdit; tabGrid.CellFormatting += tabGrid_CellFormatting; DataGridViewTextBoxCell cellTemplate = new DataGridViewTextBoxCell(); DataGridViewColumn col1 = new DataGridViewColumn(cellTemplate); col1.HeaderText = "URL"; col1.Width = 250; tabGrid.Columns.Add(col1); DataGridViewColumn col2 = new DataGridViewColumn(cellTemplate); col2.HeaderText = "Description"; col2.Width = 250; tabGrid.Columns.Add(col2); DataGridViewColumn col3 = new DataGridViewColumn(cellTemplate); col3.HeaderText = "Username"; col3.Width = 80; tabGrid.Columns.Add(col3); DataGridViewColumn col4 = new DataGridViewColumn(cellTemplate); col4.HeaderText = "Password"; col4.Width = 80; tabGrid.Columns.Add(col4); // Top Panel topGridPanel = new Panel(); topGridPanel.Parent = this; topGridPanel.Dock = DockStyle.Top; topGridPanel.Height = 30; // Add-Delete Buttons AddRec = new Button(); AddRec.Parent = topGridPanel; AddRec.ImageList = classParent.imageList1; AddRec.ImageIndex = 10; AddRec.Top = 3; AddRec.Left = 10; AddRec.Text = ""; AddRec.Width = 30; AddRec.Click += AddRec_Click; DelRec = new Button(); DelRec.Parent = topGridPanel; DelRec.ImageList = classParent.imageList1; DelRec.ImageIndex = 9; DelRec.Top = 3; DelRec.Left = 50; DelRec.Text = ""; DelRec.Width = 30; DelRec.Click += DelRec_Click; // Grid Buttons btnURL = new Button(); btnURL.Visible = false; btnURL.Parent = tabGrid;// ParentTabControl; btnURL.ImageList = classParent.imageList1; btnURL.ImageIndex = 0; btnURL.Click += btnURL_Click; btnURL.FlatStyle = FlatStyle.Flat; btnURL.FlatAppearance.BorderSize = 0; btnUsername = new Button(); btnUsername.Visible = false; btnUsername.Parent = tabGrid;// ParentTabControl; btnUsername.ImageList = classParent.imageList1; btnUsername.ImageIndex = 1; btnUsername.Click += btnUsername_Click; btnUsername.FlatStyle = FlatStyle.Flat; btnUsername.FlatAppearance.BorderSize = 0; btnPassword = new Button(); btnPassword.Visible = false; btnPassword.Parent = tabGrid;// ParentTabControl; btnPassword.ImageList = classParent.imageList1; btnPassword.ImageIndex = 1; btnPassword.Click += btnPassword_Click; btnPassword.FlatStyle = FlatStyle.Flat; btnPassword.FlatAppearance.BorderSize = 0; }