Constructor
()
| 90 | /// Constructor |
| 91 | /// </summary> |
| 92 | public MainForm() |
| 93 | { |
| 94 | InitializeComponent(); |
| 95 | |
| 96 | // Disable the grid view's auto-creation of columns since we've |
| 97 | // entered them by hand. |
| 98 | PluginsDataGrid.AutoGenerateColumns = false; |
| 99 | |
| 100 | // The checkbox columns are bound to properties that return strings. |
| 101 | // We'll set the true and false values accordingly. |
| 102 | foreach (string colName in new string[] { InMainMenuCol.Name, InSubmenuCol.Name }) { |
| 103 | DataGridViewCheckBoxColumn column = (DataGridViewCheckBoxColumn) PluginsDataGrid.Columns[colName]; |
| 104 | column.TrueValue = "1"; |
| 105 | column.FalseValue = String.Empty; |
| 106 | } |
| 107 | |
| 108 | // Our DataGridView's checkboxes don't show up properly in larger font sizes |
| 109 | // unless the AutoSizeRowsMode is set to AllCells (or AllCellsExceptHeaders). |
| 110 | // However I find that it looks a bit too large to set it to that height... |
| 111 | // What we'll do is try to detect non-standard DPI and if found, we'll set |
| 112 | // the property (it'll produce tall rows but at least the checkboxes will show up.) |
| 113 | using (Graphics gridViewGraphics = PluginsDataGrid.CreateGraphics()) { |
| 114 | if (((int) gridViewGraphics.DpiX) != StandardWindowsDPI || ((int) gridViewGraphics.DpiY) != StandardWindowsDPI) { |
| 115 | PluginsDataGrid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders; |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | // Connect all checkboxes in the Options page to the CheckChanged event handler that |
| 120 | // will enable the Apply button. |
| 121 | foreach (Control control in MiscOptionsPage.Controls) { |
| 122 | if (control is CheckBox) { |
| 123 | (control as CheckBox).CheckedChanged += Chk_CheckedChanged; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | // Init about "box" controls. |
| 128 | Assembly thisAssembly = GetType().Assembly; |
| 129 | Version version = thisAssembly.GetName().Version; |
| 130 | int numComponents; |
| 131 | if (version.Revision > 0) { |
| 132 | numComponents = 4; |
| 133 | } else if (version.Build > 0) { |
| 134 | numComponents = 3; |
| 135 | } else { |
| 136 | numComponents = 2; |
| 137 | } |
| 138 | ProductAndVersionLbl.Text = string.Format(CultureInfo.CurrentCulture, |
| 139 | ProductAndVersionLbl.Text, version.ToString(numComponents), |
| 140 | Settings.DevBuild ? Resources.DEV_BUILD : string.Empty); |
| 141 | CopyrightLbl.Text = GetAssemblyCopyrightString(thisAssembly); |
| 142 | MainToolTip.SetToolTip(SiteLinkLbl, SiteLinkLbl.Text); |
| 143 | MainToolTip.SetToolTip(LicenseTxtLinkLbl, Resources.MainForm_About_LicensePageURI); |
| 144 | DonationLinkLbl.Links[0].LinkData = Resources.MainForm_About_DonationsPageURI; |
| 145 | MainToolTip.SetToolTip(DonationLinkLbl, Resources.MainForm_About_DonationsPageURI); |
| 146 | } |
| 147 | |
| 148 | /// <summary> |
| 149 | /// Given the reference to an <see cref="Assembly"/>, returns the copyright |