实现效果:
知识运用:
API函数 GetSystemMetrics //返回与WINDOWS环境有关的信息
实现代码:
private const int SM_CMOUSEBUTTONS = 43; [DllImport("user32.dll", EntryPoint = "GetSystemMetrics")] public extern static int GetSystemMetrics(int intcount); private void Form1_Load(object sender, EventArgs e) { int intCon = GetSystemMetrics(SM_CMOUSEBUTTONS); label2.Text = intCon + "个"; }