Skip to content

Commit c32caba

Browse files
committed
Spore ModAPI Easy Installer: remove NoConfigIcon from window
1 parent 5595487 commit c32caba

File tree

5 files changed

+37
-34
lines changed

5 files changed

+37
-34
lines changed

Spore ModAPI Easy Uninstaller/Properties/Resources.Designer.cs

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Spore ModAPI Easy Uninstaller/Properties/Resources.resx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,4 @@
121121
<data name="ConfigIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
122122
<value>..\Resources\config_24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
123123
</data>
124-
<data name="NoConfigIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
125-
<value>..\Resources\no-config.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
126-
</data>
127124
</root>
-8 KB
Binary file not shown.

Spore ModAPI Easy Uninstaller/Spore ModAPI Easy Uninstaller.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
</ItemGroup>
9696
<ItemGroup>
9797
<Content Include="SporeModAPIEasyUninstaller.ico" />
98-
<Content Include="Resources\no-config.png" />
9998
<None Include="Resources\config_24.png" />
10099
</ItemGroup>
101100
<ItemGroup>

Spore ModAPI Easy Uninstaller/UninstallerForm.cs

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -141,39 +141,56 @@ private void btnUninstall_Click(object sender, EventArgs e)
141141

142142
private void dataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
143143
{
144-
// if (e.ColumnIndex == this.dataGridView1.Columns["ConfiguratorColumn"].Index)
145-
if (e.ColumnIndex == 3)
144+
if (e.ColumnIndex == 3 && this.dataGridView1.SelectedRows.Count > 0)
146145
{
147146
if (e.RowIndex > 0)
148147
{
149-
var w = Properties.Resources.ConfigIcon.Width;
150-
var h = Properties.Resources.ConfigIcon.Height;
151-
var x = e.CellBounds.Left + (e.CellBounds.Width - w) / 2;
152-
var y = e.CellBounds.Top + (e.CellBounds.Height - h) / 2;
153-
154-
Bitmap image = Properties.Resources.NoConfigIcon;
155148
if (GetConfiguratorPath(e.RowIndex) != null)
156149
{
157-
image = Properties.Resources.ConfigIcon;
150+
var w = Properties.Resources.ConfigIcon.Width;
151+
var h = Properties.Resources.ConfigIcon.Height;
152+
var x = e.CellBounds.Left + (e.CellBounds.Width - w) / 2;
153+
var y = e.CellBounds.Top + (e.CellBounds.Height - h) / 2;
154+
155+
Bitmap image = Properties.Resources.ConfigIcon;
156+
e.Paint(e.CellBounds, DataGridViewPaintParts.All);
157+
e.Graphics.DrawImage(image, new Rectangle(x, y, w, h));
158+
e.Handled = true;
158159
}
160+
else
161+
{
162+
SolidBrush brush = new SolidBrush(e.CellStyle.BackColor);
163+
if (this.dataGridView1.SelectedRows[0].Index == e.RowIndex)
164+
{
165+
brush = new SolidBrush(e.CellStyle.SelectionBackColor);
166+
}
159167

160-
e.Paint(e.CellBounds, DataGridViewPaintParts.All);
161-
e.Graphics.DrawImage(image, new Rectangle(x, y, w, h));
162-
e.Handled = true;
168+
// ensure we make the cell lines visible
169+
// to make it look consistent
170+
var bounds = e.CellBounds;
171+
bounds.Height -= 5;
172+
bounds.Width -= 5;
173+
e.Paint(bounds, DataGridViewPaintParts.All);
174+
e.Graphics.FillRectangle(brush, bounds);
175+
e.Handled = true;
176+
}
163177
}
164178
else
165-
{
179+
{ // header row
166180
SolidBrush brush = new SolidBrush(e.CellStyle.BackColor);
167-
foreach (DataGridViewRow selectedRow in this.dataGridView1.SelectedRows)
181+
if (this.dataGridView1.SelectedRows[0].Index == 0)
168182
{
169-
if (selectedRow.Index == 0)
170-
{
171-
brush = new SolidBrush(e.CellStyle.SelectionBackColor);
172-
}
183+
brush = new SolidBrush(e.CellStyle.SelectionBackColor);
173184
}
174185

175-
e.Paint(e.CellBounds, DataGridViewPaintParts.All);
176-
e.Graphics.FillRectangle(brush, e.CellBounds);
186+
// ensure we make the cell lines visible
187+
// to make it look consistent
188+
var bounds = e.CellBounds;
189+
bounds.Height -= 4;
190+
bounds.Width -= 2;
191+
bounds.Y += 2;
192+
e.Paint(bounds, DataGridViewPaintParts.All);
193+
e.Graphics.FillRectangle(brush, bounds);
177194
e.Handled = true;
178195
}
179196
}

0 commit comments

Comments
 (0)