private void CreateText(TextObject textobj) { Invoke((MethodInvoker) delegate() { TextBox ctrl = GetControl(); TextData.Text text = textobj.data as TextData.Text; ctrl.Location = new Point(textobj.location.X, textobj.location.Y); ctrl.Height = textobj.location.Height; ctrl.Width = textobj.location.Width; //오류나는곳 /* * if (!ctrl.Font.Equals(text.font) && ctrl.Font != text.font) * { * ctrl.Font = text.font; * } */ ctrl.Tag = text; ctrl.Margin = new Padding(0, 0, 0, 0); ctrl.ForeColor = text.textColor.basecolor; ctrl.BackColor = text.textColor.backcolor; ctrl.MouseEnter += MouseEnterEvent; ctrl.MouseLeave += MouseLeaveEvent; ctrl.ReadOnly = true; ctrl.BorderStyle = BorderStyle.None; ctrl.Text = text.str; }); }
private Format ToType <T>(string strorigin, string name, params string[] tags) where T : TextData.Writeable, new() { string str = FixString(strorigin); foreach (TextData arg in datalist) { if (arg is TextData.Text) { TextData.Text text = arg as TextData.Text; { if (text.str.Contains(str)) { if (text.str.StartsWith(str)) { T b1 = new T(); b1.str = text.str.Substring(0, str.Length); b1.arg.name = name; b1.arg.tags = text.arg.tags; b1.arg.tags = b1.arg.tags.Concat(tags).ToArray(); TextData.Text t2 = text; t2.str = text.str.Substring(str.Length); datalist.Replace <TextData>(text, (TextData)b1, t2); return(this); } else if (text.str.EndsWith(str)) { TextData.Text t1 = text; t1.str = text.str.Substring(0, str.Length); T b2 = new T(); b2.str = text.str.Substring(str.Length); b2.arg.name = name; b2.arg.tags = text.arg.tags; b2.arg.tags = b2.arg.tags.Concat(tags).ToArray(); datalist.Replace <TextData>(text, t1, (TextData)b2); return(this); } else { int index = text.str.IndexOf(str); int length = str.Length; TextData.Text t1 = text; t1.str = text.str.Substring(0, index); T b2 = new T(); b2.str = text.str.Substring(index, length); b2.arg.name = name; b2.arg.tags = text.arg.tags; b2.arg.tags = b2.arg.tags.Concat(tags).ToArray(); TextData.Text t3 = text; t3.str = text.str.Substring(index + length); datalist.Replace <TextData>(text, t1, (TextData)b2, t3); return(this); } } } } } return(this); }