c#简单操作注册表
一、首先先添加引用 using Microsoft.Win32;
//因为操作注册表的两个类RegistryKey和Registry都包含在此引用中;
二、编写代码开始操作注册表
1、 #region 限制软件的使用次数
private void BtnTimes_Click(object sender, EventArgs e)
{
try
{
//在注册表中创建子键
RegistryKey rk = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\Currentversion\\Run\\nums"); //CreateSubKey打开和创建两种功能
int numscount = (int)rk.GetValue("nums", 0); //读取注册表中软件使用次数
if (numscount >= 10)
{
MessageBox.Show("不好意思,你是非注册用户,只能免费使用十次,请注册!", "系统提示", MessageBoxButtons.OK,MessageBoxIcon.Warning);
rk.Close(); //关闭注册表
this.Close(); //退出程序
}
&n
相关文档:
已知有一个XML文件(bookstore.xml)如下:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
&n ......
创建一个Winform用户控件 UserControl1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Reflection;
namespace MyActiveT ......
OleDbConnection conn = null;
try
{
`string strConn;
&n ......
http://www.tangiblesoftwaresolutions.com/Product_Details/Instant_CSharp.html
http://www.tangiblesoftwaresolutions.com/?gclid=COeGzKKxo58CFQIupAodu2jvJQ
在线
VB.net和C#在线互转工具
http://bbs.51aspx.com/showtopic-2059.html
Convert VB.NET to C#
http://www.developerfusion.com/tools/convert/vb-to- ......
C#实现Windows Form的透明背景用下面这段代码能实现非常有意思真正的透明背景,透明的地方不仅能显示其下一层的图案,而且能让鼠标穿越过去,成为真正的透明化。
注释掉的3行中,前2行代码是实现透明效果的另外第一个办法,最后1行是第三种办法。
但第一个方法根本不起作用,因为Windows Form所用“调色板”是&l ......