style change session panel

This commit is contained in:
Jannick van Ballegooijen
2015-10-20 16:56:29 +02:00
parent 33a5ffe7af
commit 679d3ad4ef
2 changed files with 29 additions and 9 deletions
@@ -58,7 +58,7 @@ namespace ErgometerDoctorApplication
foreach (Tuple<string,double,int> sessiondata in historys)
{
flowlayout.Controls.Add(new SessionPanel(sessiondata.Item3, sessiondata.Item1, false));
flowlayout.Controls.Add(new SessionPanel(sessiondata.Item3, sessiondata.Item1, false,sessiondata.Item2));
}
}
}
+28 -8
View File
@@ -7,23 +7,25 @@ namespace ErgometerDoctorApplication
private int Session;
private string Name;
private bool IsNew;
private double timestamp;
public SessionPanel(int session, string name, bool isNew) : base()
public SessionPanel(int session, string name, bool isNew,double timestamp) : base()
{
this.timestamp = timestamp;
Session = session;
Name = name;
IsNew = isNew;
this.Location = new System.Drawing.Point(0, 0);
this.Size = new System.Drawing.Size(180, 100);
this.BackColor = System.Drawing.Color.White;
this.BackColor = System.Drawing.Color.DarkGray;
this.Click += SessionPanel_Click;
this.MouseEnter += SessionPanel_MouseEnter;
this.MouseLeave += SessionPanel_MouseLeave;
this.Cursor = Cursors.Hand;
this.labelTimestamp = new Label();
this.labelName = new System.Windows.Forms.Label();
//
@@ -33,7 +35,7 @@ namespace ErgometerDoctorApplication
this.labelName.AutoSize = true;
this.labelName.Font = new System.Drawing.Font("Segoe UI Semibold", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelName.Location = new System.Drawing.Point(10, 10);
this.labelName.ForeColor = System.Drawing.Color.Gray;
this.labelName.ForeColor = System.Drawing.Color.White;
this.labelName.Name = "labelActiveSessions";
this.labelName.Size = new System.Drawing.Size(103, 21);
this.labelName.TabIndex = 3;
@@ -43,19 +45,36 @@ namespace ErgometerDoctorApplication
this.labelName.MouseLeave += SessionPanel_MouseLeave;
this.labelName.Cursor = Cursors.Hand;
this.labelTimestamp.Name = "labelTimeStamp";
this.labelTimestamp.Anchor = AnchorStyles.None;
this.labelTimestamp.Text = ErgometerLibrary.Helper.MillisecondsToTime(timestamp);
this.labelTimestamp.Location = new System.Drawing.Point(10, 40);
this.labelTimestamp.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTimestamp.ForeColor = System.Drawing.Color.White;
this.labelTimestamp.Size = new System.Drawing.Size(103, 21);
this.labelTimestamp.Click += SessionPanel_Click;
this.labelTimestamp.MouseEnter += SessionPanel_MouseEnter;
this.labelTimestamp.MouseLeave += SessionPanel_MouseLeave;
if (isNew)
labelTimestamp.Visible = false;
this.Controls.Add(labelName);
this.Controls.Add(labelTimestamp);
}
private void SessionPanel_MouseEnter(object sender, System.EventArgs e)
{
this.BackColor = System.Drawing.Color.LightGray;
this.labelName.ForeColor = System.Drawing.Color.DarkGray;
this.BackColor = System.Drawing.Color.Gray;
this.labelName.ForeColor = System.Drawing.Color.WhiteSmoke;
labelTimestamp.ForeColor = System.Drawing.Color.WhiteSmoke;
}
private void SessionPanel_MouseLeave(object sender, System.EventArgs e)
{
this.BackColor = System.Drawing.Color.White;
this.labelName.ForeColor = System.Drawing.Color.Gray;
this.BackColor = System.Drawing.Color.DarkGray;
this.labelName.ForeColor = System.Drawing.Color.White;
this.labelTimestamp.ForeColor = System.Drawing.Color.White;
}
private void SessionPanel_Click(object sender, System.EventArgs e)
@@ -67,5 +86,6 @@ namespace ErgometerDoctorApplication
}
public System.Windows.Forms.Label labelName;
public Label labelTimestamp;
}
}