using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;using System.Management;//这个别忘了加哦//Colder By :linqifo074 //U should reserve this Message for//commercial use!!!namespace JudgeIslabtop...{ public partial class Form1 : Form ...{ public Form1() ...{ InitializeComponent(); } public enum ChassisTypes...{// 其他的太多了,E文水平不高,没法翻译,baidu也没有用,如果你会 //翻译可以告诉我 Other = 1,//其他类型 Unknown, Desktop台式机, LowProfileDesktop, PizzaBox, MiniTower, Tower,//貌似塔式服务器? Portable, Laptop膝上型电脑, Notebook笔记本电脑,//10 Handheld,//手持型的 DockingStation, AllInOne, SubNotebook轻量级便携式计算机, SpaceSaving, LunchBox, MainSystemChassis, ExpansionChassis, SubChassis, BusExpansionChassis, PeripheralChassis, StorageChassis, RackMountChassis, SealedCasePC} public static ChassisTypes GetCurrentChassisType()...{//这个类的用法你可以查阅msdn,这里只告诉你方法 //代码也很简单,复制粘贴一下就可以用了 ManagementClass systemEnclosures = new ManagementClass("Win32_SystemEnclosure"); foreach (ManagementObject obj in systemEnclosures.GetInstances()) ...{ foreach (int i in (UInt16[])(obj["ChassisTypes"])) ...{ if (i > 0 && i < 25) ...{ return (ChassisTypes)i; } } } return ChassisTypes.Unknown;//返回未知类型} private void button1_Click(object sender, EventArgs e) ...{ MessageBox.Show ( GetCurrentChassisType().ToString() ); } }}