Skip to content

Commit

Permalink
Added some styling for better UX
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed Nov 4, 2023
1 parent 4c28765 commit e7555f5
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
3 changes: 2 additions & 1 deletion MiniserverForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 46 additions & 1 deletion MiniserverForm.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
Expand Down Expand Up @@ -297,6 +297,51 @@ private void MiniserverForm_Load(object sender, EventArgs e)
RefreshGridView();
}

private void DataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == 1) // The Name column is at index 1
{
var fileItem = _fileItems[e.RowIndex];
if (fileItem.Name == "Download to view description")
{
e.CellStyle.Font = new System.Drawing.Font(e.CellStyle.Font, System.Drawing.FontStyle.Italic);
}
else
{
e.CellStyle.Font = new System.Drawing.Font(e.CellStyle.Font, System.Drawing.FontStyle.Regular);
}
}
if (e.ColumnIndex == 3) // The Status column is at index 3
{
var fileItem = _fileItems[e.RowIndex];
switch (fileItem.Status)
{
case "Only on MS":
e.CellStyle.BackColor = System.Drawing.Color.LightGray;
break;
case "Only on FS":
e.CellStyle.BackColor = System.Drawing.Color.LightGoldenrodYellow;
break;
case "Newer on MS":
e.CellStyle.BackColor = System.Drawing.Color.LightGreen;
break;
case "Newer on FS":
e.CellStyle.BackColor = System.Drawing.Color.LightSkyBlue;
break;
case "Larger on MS":
e.CellStyle.BackColor = System.Drawing.Color.LightGreen;
break;
case "Larger on FS":
e.CellStyle.BackColor = System.Drawing.Color.LightSkyBlue;
break;
default:
e.CellStyle.BackColor = System.Drawing.Color.White;
break;
}
}

}

private void DataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
{
try
Expand Down

0 comments on commit e7555f5

Please sign in to comment.