Exemplo n.º 1
0
        /// <summary>
        /// 得到注册表中配置信息
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string GetValue(string item, SetKey key)
        {
            RegisterHelper rh = new RegisterHelper();

            if (!rh.isExist(RegisterHelper.keyType.HKEY_CURRENT_USER, item))
            {
                rh.setValue(RegisterHelper.keyType.HKEY_CURRENT_USER, item, "SaveType", "1");//保存方式:1,保存到另一个文件夹  2,覆盖
                rh.setValue(RegisterHelper.keyType.HKEY_CURRENT_USER, item, "LimitSize", "512");//图片上限
                rh.setValue(RegisterHelper.keyType.HKEY_CURRENT_USER, item, "Percent", "0.95");//压缩率
            }
            return rh.getValue(RegisterHelper.keyType.HKEY_CURRENT_USER, item, key.ToString());
        }
Exemplo n.º 2
0
 /// <summary>
 /// 保存配置信息到注册表
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 public static void SetValue(string item, SetKey key, string value)
 {
     RegisterHelper rh = new RegisterHelper();
     rh.setValue(RegisterHelper.keyType.HKEY_CURRENT_USER, item, key.ToString(), value);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 窗体关闭事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     RegisterHelper rh = new RegisterHelper();
     string saveType = "";
     for (int i = 0; i < gbSelSaveType.Controls.Count; i++)//将它们放入容器里
     {
         if (gbSelSaveType.Controls[i] is RadioButton)
         {
             RadioButton temp = (RadioButton)gbSelSaveType.Controls[i];
             if (temp.Checked)//判断是否选中
             {
                 saveType = temp.Tag.ToString();
             }
         }
     }
     CommonHelper.SetValue(item, SetKey.SaveType, saveType);
     CommonHelper.SetValue(item, SetKey.LimitSize, numLimitSize.Value.ToString());
     CommonHelper.SetValue(item, SetKey.Percent, numPercent.Value.ToString());
 }