Button
Button默认不产生DoubleClick事件
(MSDN说明:https://msdn.microsoft.com/zh-cn/library/system.windows.forms.button.doubleclick(v=vs.110).aspx)
使用MouseUp事件捕获右键点击操作
WebBrowser
强制在控件中打开新窗口:NewWindow事件中设置e.Cancel
private void WebBrowserView_NewWindow(object sender, CancelEventArgs e)
{
WebBrowserView.Navigate(WebBrowserView.StatusText);
e.Cancel = true;
}
屏蔽脚本错误提示:将ScriptErrorsSuppressed属性设为true
AssemblyInfo
获取AssemblyInfo中设置的版本号:
Assembly.GetExecutingAssembly().GetName().Version
Web Service
引用Web Service时不依赖配置文件:在代码中完成Web Service实例的初始化
m_Service = new MyService.service();
m_Service.Url = "http://www.mysite.com/service.php";
DEBUG-服务器提交了协议冲突 Section=ResponseStatusLine
将服务引用改为Web引用
Form
以隐藏方式启动主窗口:
有时候需要主窗口隐藏启动,但是因为Winform的内部机制问题,在主窗口的Load事件处理程序里调用Hide()将不起作用。
变通方法:将WindowState设为Minimized,将ShowInTaskbar设为false。