Pomoc oko C#

using System.Windows.Forms;
using System.ComponentModel;
namespace SysInfoLib
{
public class SysInfo: Component{
public SysInfo(){}
public string UserName
{
get
{
return SystemInformation.UserName;
}
}

public string ComputerName
{
get
{
return SystemInformation.ComputerName;
}
}

public string Network
{
get
{
if(SystemInformation.Network)
return "Connected";
else
return "Disconnected";

}
}
public string MonitorInfo
{
get
{
return SystemInformation.MonitorCount.ToString();
}
}

public string MouseInfo
{
get
{
if(SystemInformation.MousePresent)
{
return SystemInformation.MouseButtons.ToString() + " Button Mouse";
}
else
return "No Mouse Connected";
}
}
public string BootInfo
{
get
{
if(SystemInformation.BootMode==BootMode.Normal)
return "Normal";
else if(SystemInformation.BootMode==BootMode.FailSafe)
return "Started In Safe Mode";
else if(SystemInformation.BootMode==BootMode.FailSafeWithNetwork)
return "Started In Safe Mode with Network Support";
else
return "No info";
}
}
}
}
ovako nesto mislis ? samo napravi click-event i to je to mislim :)
 
private static bool bStat=false;


private void button1_Click(object sender, EventArgs e)
{
bStat=true;
this.Refresh();
}


protected override void OnPaint(PaintEventArgs e) {
if(bStat)
{
SysInfo s=new SysInfo();
string sysStr="User Name: "+s.UserName;
sysStr+="\nComputer Name: "+s.ComputerName;
sysStr+="\nBoot Information: "+s.BootInfo;
sysStr+="\nNetwork Information: "+s.Network;
sysStr+="\nMonitor Information: "+s.MonitorInfo;
sysStr+="\nMouse Information: "+s.MouseInfo;
Graphics g = e.Graphics;
g.DrawString(sysStr, this.Font, new SolidBrush(Color.Black), 10,100);
s.Dispose();
bStat=false;
}
}
 

Back
Top