摘要:
using system;
using system.diagnostics;
using system.threading;
public class cpuloadinfo
{
// auxiliary print methods
private static void say ( string txt )
{
console.writeline(txt);......
摘要:
最近在论坛中不少网友问"如何把windows安装的所有打印机列出来",在下面的程序中我们将把系统中所安装的打印机用列表框列出来,同时为默认打印机设置缺省值。
在下面的程序中我们用到了两个主要的类,把所有的打印机列表出来用到了printersettings 类,获取系统默认打印机用到了printdocument 类,下面我们就动手实践一下吧。
先新建一......
使用C#返回系统特殊路径
using system;
using microsoft.win32;
namespace systempathsapp
{
/// <summary>
/// summary description for systempaths.
/// </summary>
public class systempaths
{
public systempaths()
{
//
// todo: add constructor logic here
//
folders = openregistrypath(registry.currentuser,@"\software\microsoft\windows\currentversion\explorer\shell folders");
}
private registrykey folders;
private registrykey openregistrypath(registrykey root,string s)
{
s = s.remove(0,1) + @"\";
while (s.indexof(@"\") != -1)
{
root = root.opensubkey(s.substring(0,s.indexof(@"\")));
s = s.remove(0,s.indexof(@"\") + 1);
}
return root;
}
/// <summary>
/// </summary>
/// <param name="path">
/// desktop 桌面目录
/// fonts 字体目录
/// nethood 网上邻居
...
下一页 摘要:
面向对象设计vs.实用主义
这种方法的缺点之一是你必须使用一个大的switch语句结束,但是前辈一直教导我们大的switch语句是较差的设计的表现。通常的面向对象(object oriented,oo)的途径是使用多态性(polymorphism)的。为了达到这个目的,我们先建立一个抽象的基类(base class),接着从该类衍生出所有的消息对象。每个类需要执行串行化、......