diff --git a/GCSViews/ConfigurationView/ConfigRawParams.Designer.cs b/GCSViews/ConfigurationView/ConfigRawParams.Designer.cs index 8b5e67aafd..8007d46944 100644 --- a/GCSViews/ConfigurationView/ConfigRawParams.Designer.cs +++ b/GCSViews/ConfigurationView/ConfigRawParams.Designer.cs @@ -1,4 +1,4 @@ -using MissionPlanner.Controls; +using MissionPlanner.Controls; namespace MissionPlanner.GCSViews.ConfigurationView { @@ -241,6 +241,7 @@ private void InitializeComponent() // this.Params.AllowUserToAddRows = false; this.Params.AllowUserToDeleteRows = false; + this.Params.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle1.BackColor = System.Drawing.Color.Maroon; dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -287,7 +288,6 @@ private void InitializeComponent() // // Command // - this.Command.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; this.Command.FillWeight = 20F; resources.ApplyResources(this.Command, "Command"); this.Command.Name = "Command"; @@ -295,12 +295,14 @@ private void InitializeComponent() // // Value // + this.Value.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; this.Value.FillWeight = 11F; resources.ApplyResources(this.Value, "Value"); this.Value.Name = "Value"; // // Default_value // + this.Default_value.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; this.Default_value.FillWeight = 11F; resources.ApplyResources(this.Default_value, "Default_value"); this.Default_value.Name = "Default_value"; @@ -308,7 +310,6 @@ private void InitializeComponent() // // Units // - this.Units.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; this.Units.FillWeight = 9F; resources.ApplyResources(this.Units, "Units"); this.Units.Name = "Units"; @@ -316,6 +317,7 @@ private void InitializeComponent() // // Options // + this.Options.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; this.Options.FillWeight = 28F; resources.ApplyResources(this.Options, "Options"); this.Options.Name = "Options"; diff --git a/GCSViews/ConfigurationView/ConfigRawParams.cs b/GCSViews/ConfigurationView/ConfigRawParams.cs index dc710e78fd..eb90c966e3 100644 --- a/GCSViews/ConfigurationView/ConfigRawParams.cs +++ b/GCSViews/ConfigurationView/ConfigRawParams.cs @@ -1,4 +1,4 @@ -using log4net; +using log4net; using MissionPlanner.Controls; using MissionPlanner.Utilities; using System; @@ -588,9 +588,8 @@ internal void processToScreen() log.Info("about to add all"); - Params.SuspendLayout(); + SuspendParamGridView(); Params.Visible = false; - Params.Enabled = false; Params.Rows.AddRange(rowlist.ToArray()); @@ -600,9 +599,8 @@ internal void processToScreen() Params.Sort(Params.Columns[Command.Index], ListSortDirection.Ascending); - Params.Enabled = true; Params.Visible = true; - Params.ResumeLayout(); + ResumeParamGridView(); if (splitContainer1.Panel1Collapsed == false) { @@ -712,8 +710,7 @@ private void updatedefaultlist(object crap) void filterList(string searchfor) { DateTime start = DateTime.Now; - Params.SuspendLayout(); - Params.Enabled = false; + SuspendParamGridView(); if (searchfor.Length >= 2 || searchfor.Length == 0) { Regex filter = new Regex(searchfor.Replace("*", ".*").Replace("..*", ".*"), RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline); @@ -762,8 +759,7 @@ void filterList(string searchfor) } } - Params.Enabled = true; - Params.ResumeLayout(); + ResumeParamGridView(); log.InfoFormat("Filter: {0}ms", (DateTime.Now - start).TotalMilliseconds); } @@ -1171,6 +1167,20 @@ private void Params_ColumnWidthChanged(object sender, DataGridViewColumnEventArg optionsControlUpateBounds(); } } + + void SuspendParamGridView() + { + Params.SuspendLayout(); + Params.Enabled = false; + Params.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; + } + + void ResumeParamGridView() + { + Params.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + Params.Enabled = true; + Params.ResumeLayout(); + } } }