1 pièce(s) jointe(s)
ToolStrip + DataGrid : un bout de DataGrid est caché sous le TooStrip
salut les gars,
je crée par programmation un formulaire contenant :
-ToolStrip (barre d'outils)
-DataGrid
mon probleme : la DataGrid passe sous le ToolStrip ce qui me cache le titre des colonnes (voir photo).
voici le code pour le formulaire :
Code:
1 2 3 4 5 6 7 8 9 10
| this._form = new Form();
this._form.BackColor = Color.Black;
this._form.Text = "Panneau Debug";
this._form.StartPosition = FormStartPosition.Manual;
this._form.Width = Screen.AllScreens[(Screen.AllScreens.Count() - 1)].Bounds.Width;
this._form.Height = Screen.AllScreens[(Screen.AllScreens.Count() - 1)].Bounds.Height - 25;
this._form.Left = Screen.PrimaryScreen.Bounds.Width + ((Screen.AllScreens[(Screen.AllScreens.Count() - 1)].Bounds.Width / 2) - (this._form.Width / 2));
this._form.Top = (Screen.AllScreens[(Screen.AllScreens.Count() - 1)].Bounds.Height / 2) - (this._form.Height / 2);
this._form.FormClosing += new FormClosingEventHandler(this.form_Closing);
this._form.TopMost = true; |
le ToolStrip :
Code:
1 2 3 4 5 6 7
| ToolStrip barreOutils = new ToolStrip();
barreOutils.Items.AddRange(new ToolStripItem[] {btBoEffacer, btBoDefiler});
barreOutils.Name = "barreOutils";
barreOutils.TabIndex = 1;
barreOutils.Dock = DockStyle.Top;
this._form.Controls.Add(barreOutils); |
la DataGrig :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| this._dtGrid = new DataGridView();
this._dtGrid.Columns.AddRange(new DataGridViewColumn[] { col1, col2, col3 });
this._dtGrid.Dock = DockStyle.Fill;
//this._dtGrid.Anchor = AnchorStyles.Top;
//this._dtGrid.Top = barreOutils.Height;
this._dtGrid.Name = "dataGridView1";
//this._dtGrid.Size = new Size(this._form.Width, this._form.Height);
this._dtGrid.TabIndex = 2;
this._dtGrid.ColumnHeadersHeight += 10;
this._dtGrid.RowHeaderMouseDoubleClick += new DataGridViewCellMouseEventHandler(this.dtGrid_RowHeaderMouseDoubleClick);
this._form.Controls.Add(this._dtGrid);
this._form.Show(); |
j'ai essayé plein de solution avec différentes valeurs/combinaisons de DockStyle et AnchorStyles mais rien de concluant.
donc pour l'instant j'ai du rajouter un evenement qui redimensionne la DataGrid :aie:
il doit exister une propriété (ou autre) pour empêcher la DataGrid de passer sous le ToolStrip ?
merci