Exemplo n.º 1
0
 /// <summary>
 /// 实例化文本选择对话框
 /// </summary>
 /// <returns>返回该对话框</returns>
 public static object openFileMethod(Dictionary <Type, object> data)
 {
     if (data.ContainsKey(typeof(TextBox)) && data[typeof(TextBox)] is TextBox)
     {
         // 获取新的文本框
         PublicEventMet.openFileMethod(null);
     }
     else
     {
         MessageBox.Show("无法获取文本框");
     }
     return(null);
 }
Exemplo n.º 2
0
 /// <summary>
 /// 实例化文件保存对话框保存文本
 /// </summary>
 /// <param name="t">要保存内容的文本框</param>
 /// <returns></returns>
 public static object saveFileMethod(Dictionary <Type, object> data)
 {
     // 获取文本框
     if (data.ContainsKey(typeof(TextBox)) && data[typeof(TextBox)] is TextBox)
     {
         TextBox t = (TextBox)data[typeof(TextBox)];
         PublicEventMet.saveFileMethod(t);
     }
     else
     {
         MessageBox.Show("无法获取文本框");
     }
     return(null);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 实例化字体对话框
 /// </summary>
 /// <returns></returns>
 public static object fontDialogMethod(Dictionary <Type, object> data)
 {
     // 判断是否存在文本框
     if (data.ContainsKey(typeof(TextBox)) && data[typeof(TextBox)] is TextBox)
     {
         TextBox t   = (TextBox)data[typeof(TextBox)];
         object  obj = PublicEventMet.fontDialogMethod(t);
         if (obj != null && obj is Dictionary <string, object> )
         {
             Dictionary <string, object> dic = (Dictionary <string, object>)obj;
             // 获取字体设置对话框
             FontDialog fontD = dic.ContainsKey("1") && dic["1"] is FontDialog? (FontDialog)dic["1"] : null;
             // 是否点击了确定
             DialogResult ok = dic.ContainsKey("2") && dic["2"] is DialogResult? (DialogResult)dic["2"] : DialogResult.None;
             if (DialogResult.OK.Equals(ok) && fontD != null)
             {
                 // 询问是否将该字体应用到全部的文本框
                 ControlsUtils.ShowAskMessBox("是否将该字体应用到全部的文本框中", "设置字体",
                                              delegate {
                     MainTextBConfig.TEXTBOX_FONT = fontD.Font;
                     // 获取tab容器中的全部的主文本框
                     TextBox[] textAll = ControlCacheFactory.getSingletonChildCon <TextBox>(DefaultNameEnum.TAB_CONTENT);
                     if (textAll != null)
                     {
                         foreach (TextBox textB in textAll)
                         {
                             if (textB.Name.IndexOf(EnumUtils.GetDescription(DefaultNameEnum.TEXTBOX_NAME_DEF)) >= 0)
                             {
                                 // 设置字体
                                 textB.Font = fontD.Font;
                             }
                         }
                     }
                 }, null);
             }
         }
     }
     else
     {
         MessageBox.Show("无法获取文本框");
     }
     return(null);
 }