92 lines
2.3 KiB
C#
92 lines
2.3 KiB
C#
/*
|
|
* Erstellt mit SharpDevelop.
|
|
* Benutzer: 001142709
|
|
* Datum: 10.04.2018
|
|
* Zeit: 12:19
|
|
*
|
|
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
|
|
*/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace NxLizenz
|
|
{
|
|
/// <summary>
|
|
/// Description of LicenseItem.
|
|
/// </summary>
|
|
public partial class LicenseItem : UserControl
|
|
{
|
|
public int Available { set; get; }
|
|
public int InUse { set; get; }
|
|
public string LicName { set; get; }
|
|
public string Version { set; get; }
|
|
public string Vendor { set; get; }
|
|
public string Type { set; get; }
|
|
public int Percent { set; get; }
|
|
public int ProgressBarLenght { set; get; }
|
|
public int Threshold { set; get; }
|
|
|
|
public LicenseItem()
|
|
{
|
|
//
|
|
// The InitializeComponent() call is required for Windows Forms designer support.
|
|
//
|
|
InitializeComponent();
|
|
|
|
ProgressBarLenght = 610;
|
|
//
|
|
// TODO: Add constructor code after the InitializeComponent() call.
|
|
//
|
|
}
|
|
|
|
private void pictureBox1_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
int endPosX = 5 + Threshold;
|
|
|
|
using (var pen = new Pen(Color.Red, 24))
|
|
{
|
|
e.Graphics.DrawLine(pen, 5, 66, endPosX, 66);
|
|
}
|
|
}
|
|
|
|
private void pictureBox2_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
int startPosX = 5 + Threshold;
|
|
int endPos = 5 + ProgressBarLenght;
|
|
|
|
using (var pen = new Pen(Color.Lime, 24))
|
|
{
|
|
e.Graphics.DrawLine(pen, startPosX, 66, endPos, 66);
|
|
}
|
|
}
|
|
|
|
private void pictureBox3_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
using (var myFont = new Font("Arial", 12))
|
|
{
|
|
e.Graphics.DrawString("In use: " + Percent + "%", myFont, Brushes.Black, new Point(ProgressBarLenght / 2 - 73, 56));
|
|
}
|
|
}
|
|
|
|
public void ShowCurrentValues()
|
|
{
|
|
LicenseName.Text = LicName;
|
|
labelAvailable.Text = String.Concat("Available: ", Available);
|
|
labelInUse.Text = String.Concat("In use: ", InUse);
|
|
labelVersion.Text = String.Concat("Version: ", Version);
|
|
labelVendor.Text = String.Concat("Vendor: ", Vendor);
|
|
labelType.Text = String.Concat("Type: ", Type);
|
|
|
|
Percent = (int)((double)InUse / Available * 100);
|
|
Threshold = (int)((Double)ProgressBarLenght / 100 * Percent);
|
|
|
|
Paint += pictureBox1_Paint;
|
|
Paint += pictureBox2_Paint;
|
|
Paint += pictureBox3_Paint;
|
|
}
|
|
}
|
|
}
|