如果需要在启动设计器时不显示欢迎页面弹窗,可以在调用设计器前使用下面的代码
- RegistryKey designerKey = GetDesignerKey();
- try
- {
- designerKey.SetValue("StartupScreen", "False", Microsoft.Win32.RegistryValueKind.String);
- }
- catch
- { }
- finally
- {
- if (designerKey != null)
- {
- designerKey.Close();
- }
- }
- private static RegistryKey GetDesignerKey()
- {
- RegistryKey softwareKey = null;
- RegistryKey settingsKey = null;
- RegistryKey designKey = null;
- RegistryKey StartupKey = null;
- try
- {
- softwareKey = Registry.CurrentUser.OpenSubKey("Software", true);
- // VB and VBA Program Settings
- settingsKey = softwareKey.OpenSubKey("VB and VBA Program Settings", true);
- if (settingsKey == null)
- {
- softwareKey.CreateSubKey("VB and VBA Program Settings");
- settingsKey = softwareKey.OpenSubKey("VB and VBA Program Settings", true);
- } // Spread grid key
- designKey = settingsKey.OpenSubKey("FarPoint.Win.Spread.Design", true);
- if (designKey == null)
- {
- settingsKey.CreateSubKey("FarPoint.Win.Spread.Design");
- designKey = settingsKey.OpenSubKey("FarPoint.Win.Spread.Design", true);
- } StartupKey = designKey.OpenSubKey("Startup", true);
- if (StartupKey == null)
- {
- designKey.CreateSubKey("Startup");
- StartupKey = designKey.OpenSubKey("Startup", true);
- }
- }
- catch
- {
- }
- finally
- {
- if (settingsKey != null)
- {
- settingsKey.Close();
- }
- if (designKey != null)
- {
- designKey.Close();
- }
- } return StartupKey;
- }
复制代码 |