Windows程序设计
tianxingzhe37
一切从心开始!
展开
-
利用注册表得到CPU信息
一.由于没有直接可得到CPU信息的API函数,这里使用注册表来得到CPU信息。通过查看注册表HKEY_LOCAL_MACHINE/Hardware/Description/System/CentralProcessor/0下的键值,可以得到答案。可以用API函数RegQueryValueEx()得到这些键的信息 LONG RegQueryValueEx( HKEY hK原创 2010-05-10 20:20:00 · 4420 阅读 · 1 评论 -
获取系统的一些基本信息
//获得操作系统版本void GetOsVersion(HWND hwnd){ OSVERSIONINFO osvi; TCHAR * strOSVersion; ZeroMemory( &osvi, sizeof( osvi ) ); osvi.dwOSVersionInfoSize = sizeof( osvi ); GetVersionEx(&osvi);原创 2010-05-11 19:29:00 · 1068 阅读 · 0 评论 -
TreeView控件
1.在TreeView控件中进行选择using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace TreeView { public partial class Form1 : Form原创 2010-07-11 17:05:00 · 237 阅读 · 0 评论 -
用打开和保存对话框来打开和保存图片
<br /> private void btnOpen_Click(object sender, EventArgs e) { DialogResult result = ofDiagPicture.ShowDialog(); if (result == DialogResult.OK) { pcbKan.ImageLocation = ofDiagPicture.FileNam原创 2010-07-21 18:19:00 · 462 阅读 · 0 评论 -
让文本框只能接受数字字符
有时候希望在文本框中只能输入数字字符(比如输入年龄的时候),不希望有其他字符,这时你可以使用文本框的KeyPress事件。private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if ((e.KeyChar '9') && e.KeyChar != 8) { //e.Handled = true;表示已处理过了非数字字符和原创 2010-07-21 11:18:00 · 492 阅读 · 0 评论 -
MDI窗口程序
<br />1.让一个窗口作为主窗口,把属性IsMdiContainer设为true:<br /> this.IsMdiContainer = true;<br />2.对于某个子窗体,其属性MdiParent设为this:<br /> childFrom.MdiParent=this;<br />3.关闭子窗体<br />private void CloseChildFrom() { for (int i原创 2010-08-01 10:35:00 · 392 阅读 · 0 评论