mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Added unread indicator
This commit is contained in:
parent
1676a9eda7
commit
10229812ad
3 changed files with 14 additions and 11 deletions
|
@ -32,6 +32,7 @@ You should have received a copy of the GNU General Public License
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ShareX.HelpersLib;
|
using ShareX.HelpersLib;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
|
||||||
namespace ShareX
|
namespace ShareX
|
||||||
{
|
{
|
||||||
|
@ -45,8 +46,8 @@ public NewsListControl()
|
||||||
|
|
||||||
tlpMain.CellPaint += TlpMain_CellPaint;
|
tlpMain.CellPaint += TlpMain_CellPaint;
|
||||||
|
|
||||||
AddNewsItem(new NewsItem() { DateTimeUTC = DateTime.Now, Text = "ShareX released on Windows Store!" });
|
AddNewsItem(new NewsItem() { DateTimeUTC = DateTime.Now, Text = "ShareX released on Windows Store!\nMulti line test.", IsUnread = true });
|
||||||
AddNewsItem(new NewsItem() { DateTimeUTC = DateTime.Now, Text = "ShareX 1.8.0 released." });
|
AddNewsItem(new NewsItem() { DateTimeUTC = DateTime.Now, Text = "ShareX 1.8.0 released.", IsUnread = true });
|
||||||
AddNewsItem(new NewsItem() { DateTimeUTC = DateTime.Now, Text = "We now have a Discord server!" });
|
AddNewsItem(new NewsItem() { DateTimeUTC = DateTime.Now, Text = "We now have a Discord server!" });
|
||||||
AddNewsItem(new NewsItem() { DateTimeUTC = DateTime.Now, Text = "ShareX 1.7.0 released." });
|
AddNewsItem(new NewsItem() { DateTimeUTC = DateTime.Now, Text = "ShareX 1.7.0 released." });
|
||||||
AddNewsItem(new NewsItem() { DateTimeUTC = DateTime.Now, Text = "ShareX 1.6.0 released." });
|
AddNewsItem(new NewsItem() { DateTimeUTC = DateTime.Now, Text = "ShareX 1.6.0 released." });
|
||||||
|
@ -62,17 +63,13 @@ private void TlpMain_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
|
||||||
{
|
{
|
||||||
Color color;
|
Color color;
|
||||||
|
|
||||||
if (e.Row == 1)
|
if (e.Row.IsEvenNumber())
|
||||||
{
|
|
||||||
color = Color.FromArgb(240, 255, 240);
|
|
||||||
}
|
|
||||||
else if (e.Row.IsEvenNumber())
|
|
||||||
{
|
{
|
||||||
color = Color.FromArgb(250, 250, 250);
|
color = Color.FromArgb(250, 250, 250);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
color = Color.FromArgb(245, 245, 245);
|
color = Color.FromArgb(246, 246, 246);
|
||||||
}
|
}
|
||||||
|
|
||||||
using (Brush brush = new SolidBrush(color))
|
using (Brush brush = new SolidBrush(color))
|
||||||
|
@ -80,6 +77,11 @@ private void TlpMain_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
|
||||||
e.Graphics.FillRectangle(brush, e.CellBounds);
|
e.Graphics.FillRectangle(brush, e.CellBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NewsItems.IsValidIndex(e.Row) && NewsItems[e.Row].IsUnread && e.Column == 0)
|
||||||
|
{
|
||||||
|
e.Graphics.FillRectangle(Brushes.LimeGreen, new Rectangle(e.CellBounds.X, e.CellBounds.Y, 5, e.CellBounds.Height));
|
||||||
|
}
|
||||||
|
|
||||||
e.Graphics.DrawLine(Pens.LightGray, new Point(e.CellBounds.X, e.CellBounds.Bottom - 1), new Point(e.CellBounds.Right - 1, e.CellBounds.Bottom - 1));
|
e.Graphics.DrawLine(Pens.LightGray, new Point(e.CellBounds.X, e.CellBounds.Bottom - 1), new Point(e.CellBounds.Right - 1, e.CellBounds.Bottom - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +100,7 @@ public void AddNewsItem(NewsItem item)
|
||||||
BackColor = Color.Transparent,
|
BackColor = Color.Transparent,
|
||||||
Font = new Font("Arial", 10),
|
Font = new Font("Arial", 10),
|
||||||
Margin = new Padding(0),
|
Margin = new Padding(0),
|
||||||
Padding = new Padding(5, 8, 5, 8),
|
Padding = new Padding(10, 8, 5, 8),
|
||||||
Text = item.DateTimeUTC.ToLocalTime().ToShortDateString()
|
Text = item.DateTimeUTC.ToLocalTime().ToShortDateString()
|
||||||
};
|
};
|
||||||
tlpMain.Controls.Add(lblDateTime, 0, index);
|
tlpMain.Controls.Add(lblDateTime, 0, index);
|
||||||
|
|
|
@ -1741,13 +1741,13 @@
|
||||||
<value>Top, Bottom, Left, Right</value>
|
<value>Top, Bottom, Left, Right</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="newsListControl1.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="newsListControl1.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>320, 8</value>
|
<value>280, 8</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="newsListControl1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
<data name="newsListControl1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||||
<value>0, 0, 0, 0</value>
|
<value>0, 0, 0, 0</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="newsListControl1.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="newsListControl1.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>504, 384</value>
|
<value>544, 392</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="newsListControl1.TabIndex" type="System.Int32, mscorlib">
|
<data name="newsListControl1.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>4</value>
|
<value>4</value>
|
||||||
|
|
|
@ -35,5 +35,6 @@ public class NewsItem
|
||||||
public DateTime DateTimeUTC { get; set; }
|
public DateTime DateTimeUTC { get; set; }
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
public string URL { get; set; }
|
public string URL { get; set; }
|
||||||
|
public bool IsUnread { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue