nxlizenz_projects_visualstudio/NxLizenz/LicenseItem - Kopie.cs
2020-12-01 12:16:15 +01:00

67 lines
2.2 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 LicenseItem()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
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);
progressBarInUse.Value = Percent;
int percent = (int)(((double)(progressBarInUse.Value - progressBarInUse.Minimum) / (double)(progressBarInUse.Maximum - progressBarInUse.Minimum)) * 100);
using (Graphics gr = progressBarInUse.CreateGraphics())
{
gr.DrawString("In use: " + percent.ToString() + "%",
SystemFonts.DefaultFont,
Brushes.Black,
new PointF(progressBarInUse.Width / 2 - (gr.MeasureString("In use: " + percent.ToString() + "%",
SystemFonts.DefaultFont).Width / 2.0F),
progressBarInUse.Height / 2 - (gr.MeasureString("In use: " + percent.ToString() + "%",
SystemFonts.DefaultFont).Height / 2.0F)));
}
}
}
}