添加按钮组的一种方式
1 static string v_txt = "增加,%删除,审核||审核|%反审核|测试,查找,结账||反结账|结账"; 2 3 static void Main(string[] args) 4 { 5 string[] v_str = v_txt.Split(','); 6 List<string> lst1 = new List<string>(); 7 List<string> lst2 = new List<string>(); 8 foreach (string item in v_str) 9 { 10 if (item.IndexOf('|', 0) == -1) lst1.Add(item); 11 else lst2.Add(item); 12 } 13 foreach (string item1 in lst1) 14 { 15 if (item1.StartsWith("%")) Console.Write(item1.Substring(1)+" "); 16 else Console.Write(item1 + " "); 17 } 18 Console.WriteLine(); 19 foreach (string item2 in lst2) 20 { 21 foreach (string item3 in item2.Split('|')) 22 { 23 if (item3.StartsWith("%")) Console.Write(item3.Substring(1) + " "); 24 else Console.Write(item3 + " "); 25 } 26 Console.WriteLine(); 27 } 28 }
按钮1,%按钮2,按钮组3||按钮4|%按钮5|按钮6,按钮7
||表示前面是个按钮组,%表示分隔符,|表示按钮组下的元素
因为某种原因,最终没有使用这种方式.