Winform

 不规则 窗体 实现

View Code
1 设置窗体属性TransparencyKey的颜色和需要屏蔽的颜色一致即可

App.config读写

View Code
 1 读:
 2 System.Configuration.ConfigurationSettings.AppSettings["KeyName"]
 3 
 4 写:
 5 XmlDocument doc = new XmlDocument();
 6 doc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
 7 XmlNodeList nodes = doc.GetElementsByTagName("add");
 8 foreach (XmlNode node in nodes)
 9 {
10     XmlElement xe = (XmlElement)node;
11     if (xe.GetAttribute("key") == "KeyName")
12     xe.SetAttribute("value",value);
13 }
14 ConfigurationManager.RefreshSection("add");
15 doc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);

FindControl 的函数 遍历 控件

View Code
 1 public static System.Windows.Forms.Control FindControl(System.Windows.Forms.Control p_Control, string p_ControlName)
 2         {
 3             if (p_Control.Name == p_ControlName) return p_Control;
 4             for (int i = 0; i != p_Control.Controls.Count; i++)
 5             {
 6                 System.Windows.Forms.Control _SubControl = FindControl(p_Control.Controls[i], p_ControlName);
 7                 if (_SubControl != null) return _SubControl;
 8             }
 9             return null;
10         }
11 
12        返回的是object对象
13 
14             double 运距 = 0;
15 
16object tb = FindControl(this, "tb");
17             if (tb != null)
18             {
19                 double.TryParse((tb as TextBox).Text, out 运距);
20             }

系统浏览器打开网址

View Code
1 System.Diagnostics.Process.Start("explorer.exe", "http://www.baidu.com");
2 e.g.
3     string str = "\""+tb_PubAddress1.Text.Trim()+"\""; //前后需要加载引号,否则无法开启
4     System.Diagnostics.Process.Start("explorer.exe", str);
原文地址:https://www.cnblogs.com/wanghafan/p/2487769.html