zoukankan      html  css  js  c++  java
  • ini保存字体信息 保存颜色信息

    ini文件格式

    [WordFont]
    FontName = "方正姚体"
    FontSize = "14"
    FontStyle = "Bold"
    
    ;R G B 
    ForeColor = "10,18,255"

      IniFile ini = new IniFile(@"c:1.INI");



    const string Const_Wordfont = "WordFont";

    const string Const_FontName = "FontName"; const string Const_FontStyle = "FontStyle"; const string Const_FontSize = "FontSize";
    const string Const_ForeColor = "ForeColor"; const string Const_BackColor = "BackColor"; /*字体颜色*/ public Color FontWord_ForeColor { get { Color _color = Color.Black; try { string s = ini.ReadString(Const_Wordfont, Const_ForeColor, "1,2,3"); string[] arr = s.Split(','); if (arr.Length > 2) { int.TryParse(arr[0], out int r); int.TryParse(arr[1], out int g); int.TryParse(arr[2], out int b); _color = Color.FromArgb(r, g, b); } } catch (Exception ex) { MessageBox.Show(ex.Message); } return _color; } set { string s = "" + value.R + "," + value.G + "," + value.B; ini.WriteString(Const_Wordfont, Const_ForeColor, s); } } /*字体背景颜色*/ public Color FontWord_BackColor { get { Color _color = Color.Black; try { string s = ini.ReadString(Const_Wordfont, Const_BackColor, "1,2,3"); string[] arr = s.Split(','); if (arr.Length > 2) { int.TryParse(arr[0], out int r); int.TryParse(arr[1], out int g); int.TryParse(arr[2], out int b); _color = Color.FromArgb(r, g, b); } } catch (Exception ex) { MessageBox.Show(ex.Message); } return _color; } set { string s = "" + value.R + "," + value.G + "," + value.B; ini.WriteString(Const_Wordfont, Const_BackColor, s); } }

    Ini类

    https://files.cnblogs.com/files/xe2011/IniFiles.rar

  • 相关阅读:
    【机器学习】浅谈协方差
    python {}.format
    【机器学习】准确率、精确率、召回率
    【声纹识别】 EER
    【机器学习】 最形象的入门
    逻辑卷-LVM
    RAID及软RAID的实现
    输入数字or 字符串,统计重复次数---字典统计练习
    Python-数据结构之dict(字典*****)
    POJ 3204 网络流的必须边
  • 原文地址:https://www.cnblogs.com/xe2011/p/15390238.html
Copyright © 2011-2022 走看看