forked from activescott/lessmsi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Usability improvements in the GUI application
* Sorts the table view on the Sequence column (when it is present) * The table dropdown is a DropDownList * Columns in the property grid are automatically sized * Columns in the table grid are automatically sized Thanks and kudos to @learn-more ! 🎉
- Loading branch information
Showing
6 changed files
with
76 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,5 @@ _Resharper*/ | |
# Misc | ||
src/TestResult.xml | ||
src/.build/nuget.exe | ||
src/msbuild.log | ||
src/msbuild.log | ||
src/.vs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/LessMsi.Gui/Windows.Forms/DataGridViewExtensionMethods.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Windows.Forms; | ||
|
||
namespace LessMsi.Gui.Windows.Forms | ||
{ | ||
public static class DataGridViewExtensionMethods | ||
{ | ||
/// <summary> | ||
/// Adjusts the width of all columns to fit the contents of all cells. | ||
/// This function takes care of the edgecase where the grid is not created yet. | ||
/// (For example, when it is filled with data before the control is shown.) | ||
/// </summary> | ||
/// <param name="gridView">The target control.</param> | ||
public static void AutoResizeColumnsSafe(this DataGridView gridView) | ||
{ | ||
if (gridView.IsHandleCreated) | ||
{ | ||
gridView.AutoResizeColumns(); | ||
} | ||
else | ||
{ | ||
// If the handle is not created yet we cannot resize columns, | ||
// so delay the auto-resizing to when the control is created. | ||
gridView.HandleCreated += Grid_HandleCreated; | ||
} | ||
} | ||
|
||
private static void Grid_HandleCreated(object sender, EventArgs e) | ||
{ | ||
DataGridView dgv = sender as DataGridView; | ||
if (dgv != null) | ||
{ | ||
dgv.HandleCreated -= Grid_HandleCreated; | ||
dgv.AutoResizeColumns(); | ||
} | ||
} | ||
|
||
} | ||
} |