private void SaveCompFont() { CompFHelper = new CompFontHelper(); for (int i = 0; i < grdCompFont.Rows.Count; i++) { CompFont cf = new CompFont(); cf.Start = (int)grdCompFont.Rows[i].Cells["clStart"].Value; cf.End = (int)grdCompFont.Rows[i].Cells["clEnd"].Value; cf.Style = ((System.Drawing.Font)grdCompFont.Rows[i].Cells["clFontOptions"].Value).Style; cf.Size = ((System.Drawing.Font)grdCompFont.Rows[i].Cells["clFontOptions"].Value).Size; object fontfilename = grdCompFont.Rows[i].Cells["clFile"].Value; if (fontfilename != null) { cf.InFile = true; cf.FileName = (string)fontfilename; } else { cf.FamilyName = (string)grdCompFont.Rows[i].Cells["clFont"].Value; } CompFHelper.Add(cf); } }
public bool LoadCompFontData(string FileName) { string[] buf = null; try { buf = File.ReadAllLines(FileName); } catch { return(false); } CFont.Clear(); foreach (string s in buf) { string st = s.Trim(); if (st == string.Empty) { continue; //void string } if (st.StartsWith("#")) { continue; //comment } st = AddPathFontFolder(st); CompFont cf = new CompFont(); if (!cf.FromString(st)) { return(false); //format error } else { cf.CreateCompFont(); CFont.Add(cf); } } return(true); }
public void Add(CompFont compFont) { CFont.Add(compFont); }