Keine Cache-Version

Caching deaktiviert Standardeinstellung für diese Seite:aktiviert (code LNG204)
Wenn die Anzeige zu langsam ist, können Sie den Benutzermodus deaktivieren, um die zwischengespeicherte Version anzuzeigen.

MDIParentForm.cs

Description du code

MDIParentForm.cs est un fichier du projet BrolDev.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/broldev/src/.

Projet BrolDev : Librairie de composants réutilisables pour les applications BrolDev en CSharp.

Code source ou contenu du fichier

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. using be.gaudry.model.enums;
  6. using be.gaudry.view.controls;
  7. using be.gaudry.view.dialogs;
  8. using be.gaudry.view.style;
  9.  
  10. namespace be.gaudry.view
  11. {
  12. public partial class MDIParentForm : Form, IMDIParent
  13. {
  14.  
  15. #region declarations and constructors
  16. //private Dictionary<STYLE,ToolStripRenderer>renderers;
  17. private ToolBarHomeControl toolBarHome;
  18. private STYLE style;
  19. public MDIParentForm()
  20. {
  21. //renderers = new Dictionary<STYLE,ToolStripRenderer>();
  22. //todo : get style from settings
  23. style = STYLE.Office2007;
  24. //StyleFactory.setStyle(style);//default style
  25. Splasher.Status = "Initialisation des composants";
  26. this.InitializeComponent();
  27. resetStatusStrip();
  28. addToolBars();
  29.  
  30. Splasher.Status = "Initialisation des styles";
  31. initRenderers();
  32. /*
  33.   this.DataBindings.Add(new System.Windows.Forms.Binding("Location", global::be.gaudry.Properties.Settings.Default, "mainFormLocation", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
  34.   this.DataBindings.Add(new System.Windows.Forms.Binding("WindowState", global::be.gaudry.Properties.Settings.Default, "mainFormWindowState", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
  35.   this.DataBindings.Add(new System.Windows.Forms.Binding("StartPosition", global::be.gaudry.Properties.Settings.Default, "mainFormStartPosition", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
  36.   this.DataBindings.Add(new System.Windows.Forms.Binding("ClientSize", global::be.gaudry.Properties.Settings.Default, "mainFormClientSize", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
  37.   */
  38. }
  39.  
  40. private void addToolBars()
  41. {
  42. toolBarHome = new ToolBarHomeControl();
  43. toolBarHome.onShowOnLineHelp_Click += new EventHandler(showOnlineHelp_Click);
  44. toolBarHome.onShowOptions_Click += new EventHandler(showOptions_Click);
  45. toolBarHome.onShowSources_Click += new EventHandler(sourcesTsMi_Click);
  46. toolBarManagerControl.addToolBar(toolBarHome);
  47. }
  48. #endregion
  49.  
  50. #region misc menu methods
  51. private void exitTsMi_Click(object sender, EventArgs e)
  52. {
  53. this.Close();
  54. //Application.Exit();
  55. }
  56.  
  57. private void sourcesTsMi_Click(object sender, EventArgs e)
  58. {
  59. showMDIChild<SourcesForm>();
  60. }
  61.  
  62. protected void showOnlineHelp_Click(object sender, EventArgs e)
  63. {
  64. showMDIChild<InfobrolForm>();
  65. }
  66.  
  67. private void updateTsMi_Click(object sender, EventArgs e)
  68. {
  69. showMDIChild<UpdateDialog>();
  70. }
  71.  
  72. /// <summary>
  73. /// Override it to show another about box
  74. /// </summary>
  75. /// <param name="sender"></param>
  76. /// <param name="e"></param>
  77. protected virtual void showAboutBox_Click(object sender, EventArgs e)
  78. {
  79. new AboutBrolDevDialog().ShowDialog(this);
  80. }
  81. /// <summary>
  82. /// Override it to show some options
  83. /// </summary>
  84. /// <param name="sender"></param>
  85. /// <param name="e"></param>
  86. protected virtual void showOptions_Click(object sender, EventArgs e)
  87. {
  88. MessageBox.Show(
  89. this,
  90. "Aucune option disponible",
  91. "Options",
  92. MessageBoxButtons.OK,
  93. MessageBoxIcon.Information
  94. );
  95. }
  96.  
  97. protected void showToolBar(IToolBarControl toolBar)
  98. {
  99. if (!toolBarManagerControl.Visible)
  100. {
  101. toolBarManagerControl.Visible = true;
  102. }
  103. toolBarManagerControl.CurrentToolBar = toolBar;
  104. }
  105.  
  106. private void showHideDisplayTools_Click(object sender, EventArgs e)
  107. {
  108. displayTS.Visible = !displayTS.Visible;
  109. displayDisplayToolsTsMi.Checked = displayTS.Visible;
  110. }
  111. private void showHideAssistant_Click(object sender, EventArgs e)
  112. {
  113. toolBarManagerControl.Visible = !toolBarManagerControl.Visible;
  114. showHideWizardTsMi.Checked = toolBarManagerControl.Visible;
  115. displayMenuRightTsB.Checked = toolBarManagerControl.Visible;
  116. displayRightPanelTsMi.Checked = toolBarManagerControl.Visible;
  117. }
  118.  
  119. protected void displayMenuLeftTsB_Click(object sender, EventArgs e)
  120. {
  121. leftPanel.Visible = !leftPanel.Visible;
  122. showHideWizardTsMi.Checked = leftPanel.Visible;
  123. displayMenuLeftTsB.Checked = leftPanel.Visible;
  124. }
  125.  
  126. private void showHideStatusStrip_Click(object sender, EventArgs e)
  127. {
  128. statusStrip.Visible = !statusStrip.Visible;
  129. showHideStatusBarTsMi.Checked = statusStrip.Visible;
  130. }
  131.  
  132. #endregion
  133.  
  134. #region styles
  135. private void checkStyleItem(string current)
  136. {
  137. foreach (ToolStripMenuItem tsMi in customTSMenuItem.DropDownItems)
  138. {
  139. tsMi.Checked = tsMi.Text.Equals(current);
  140. }
  141. }
  142. private void initRenderers()
  143. {
  144. //Binding of ToolStripComboBox.ComboBox does not work... Known bug in.net
  145. /*
  146.   styleTsCB.ComboBox.DataSource = EnumHelper.ToList(typeof(STYLE));
  147.   styleTsCB.ComboBox.DisplayMember = "Value";
  148.   styleTsCB.ComboBox.ValueMember = "Key";
  149.   */
  150.  
  151. //add all STYLE enum items in the ComboBox
  152. foreach (KeyValuePair<Enum, string> kvp in EnumHelper.getDictionary(typeof(STYLE)))
  153. {
  154. /*
  155.   * We must initialize a new STYLE item to avoid than all anonym methods
  156.   * share the same local variable type.
  157.   * All instances of our anonym methods are executed by different thread than iterator method.
  158.   * That makes all delegates have the last KeyValuePair object return by the iterator.
  159.   */
  160. STYLE style = (STYLE)kvp.Key;
  161. string text = kvp.Value;
  162. ToolStripMenuItem tsMi = new ToolStripMenuItem(
  163. kvp.Value,
  164. null,
  165. delegate
  166. {
  167. StyleFactory.setStyle(style);
  168. //ToolStripManager.Renderer = renderers[style];
  169. checkStyleItem(text);
  170. }
  171. );
  172. customTSMenuItem.DropDownItems.Add(tsMi);
  173. }
  174. /*
  175.   renderers.Add(STYLE.Grey3D, new ToolStripProfessionalRenderer(new ControlStyleColors()));
  176.   renderers.Add(STYLE.Office2007, new Office2007Renderer.Office2007Renderer());
  177.   renderers.Add(STYLE.Orange, new ToolStripProfessionalRenderer(new OrangeStyleColors()));
  178.   renderers.Add(
  179.   STYLE.Aero,
  180.   new ToolStripProfessionalRenderer(new ProfessionalColorTableFactory(STYLE.Aero))
  181.   );
  182.   renderers.Add(
  183.   STYLE.Classic,
  184.   new ToolStripProfessionalRenderer(new ProfessionalColorTableFactory(STYLE.Classic))
  185.   );
  186.   renderers.Add(
  187.   STYLE.HomeStead,
  188.   new ToolStripProfessionalRenderer(new ProfessionalColorTableFactory(STYLE.HomeStead))
  189.   );
  190.   renderers.Add(
  191.   STYLE.MediaCenter,
  192.   new ToolStripProfessionalRenderer(new ProfessionalColorTableFactory(STYLE.MediaCenter))
  193.   );
  194.   renderers.Add(
  195.   STYLE.Metallic,
  196.   new ToolStripProfessionalRenderer(new ProfessionalColorTableFactory(STYLE.Metallic))
  197.   );
  198.   renderers.Add(
  199.   STYLE.NormalColor,
  200.   new ToolStripProfessionalRenderer(new ProfessionalColorTableFactory(STYLE.NormalColor))
  201.   );
  202.   renderers.Add(
  203.   STYLE.ReBar,
  204.   new RebarRenderer()
  205.   );
  206.  
  207.   */
  208. //defaultRenderer = new ToolStripProfessionalRenderer();
  209. //systemRenderer = new ToolStripSystemRenderer();
  210. }
  211. #endregion
  212.  
  213. #region Windows layout menu
  214. private void dispWinCTSMenuItem_Click(object sender, EventArgs e)
  215. {
  216. LayoutMdi(MdiLayout.Cascade);
  217. }
  218.  
  219. private void dispWinHTSMenuItem_Click(object sender, EventArgs e)
  220. {
  221. LayoutMdi(MdiLayout.TileHorizontal);
  222. }
  223.  
  224. private void dispWinVTSMenuItem_Click(object sender, EventArgs e)
  225. {
  226. LayoutMdi(MdiLayout.TileVertical);
  227. }
  228.  
  229. private void dispWinAIconsTSMenuItem_Click(object sender, EventArgs e)
  230. {
  231. LayoutMdi(MdiLayout.ArrangeIcons);
  232. }
  233. #endregion
  234.  
  235. #region override of form events
  236. /// <summary>
  237. /// Sets text on splasher,
  238. /// raises the System.Windows.Forms.Form.Load event,
  239. /// loads some form's properties like position, state, size,
  240. /// and closes the splasher
  241. /// </summary>
  242. /// <param name="e">An System.EventArgs that contains the event data.</param>
  243. protected override void OnLoad(EventArgs e)
  244. {
  245. Splasher.Status = "Tentative de lecture des paramètres de la fenêtre";
  246. base.OnLoad(e);
  247. /*try
  248.   {
  249.   WindowState = (FormWindowState)Enum.Parse(
  250.   typeof(FormWindowState),
  251.   System.Configuration.ConfigurationManager.AppSettings["mainFormState"]
  252.   );
  253.   }
  254.   catch (Exception) { WindowState = FormWindowState.Normal; }*/
  255. try
  256. {
  257. this.Size = Properties.Settings.Default.mainFormClientSize;
  258. this.Location = Properties.Settings.Default.mainFormLocation;
  259. this.WindowState = Properties.Settings.Default.mainFormWindowState;
  260. this.StartPosition = Properties.Settings.Default.mainFormStartPosition;
  261. }
  262. catch{}
  263.  
  264. //ToolStripManager.Renderer = StyleFactory.ToolStripRenderer;//renderers[style];
  265. checkStyleItem(EnumHelper.GetDescription(style));
  266. //toolBarManagerControl.CurrentToolBar = toolBarHome;//set console as current if displayed on the config
  267. //Splasher.close();//close splasher in the inherited form
  268. }
  269. /// <summary>
  270. /// Save some form's properties like position, state, size, and
  271. /// raises the System.Windows.Forms.Form.FormClosing event
  272. /// </summary>
  273. /// <param name="e">An System.EventArgs that contains the event data.</param>
  274. protected override void OnFormClosing(FormClosingEventArgs e)
  275. {
  276. //Config.saveAppSetting("mainFormState", Enum.GetName(typeof(FormWindowState), WindowState));
  277. Properties.Settings.Default.mainFormWindowState = this.WindowState;
  278. if (this.WindowState == FormWindowState.Normal)
  279. {
  280. Properties.Settings.Default.mainFormClientSize = this.Size;
  281. Properties.Settings.Default.mainFormLocation = this.Location;
  282. }
  283. else
  284. {
  285. Properties.Settings.Default.mainFormClientSize = this.RestoreBounds.Size;
  286. Properties.Settings.Default.mainFormLocation = this.RestoreBounds.Location;
  287. }
  288.  
  289. Properties.Settings.Default.mainFormStartPosition = this.StartPosition;
  290. Properties.Settings.Default.Save();
  291.  
  292. base.OnFormClosing(e);
  293. }
  294. #endregion
  295.  
  296. protected Image AboutImage
  297. {
  298. get { return this.toolBarHome.AboutImage; }
  299. set
  300. {
  301. this.toolBarHome.AboutImage = value;
  302. this.BackgroundImage = toolBarHome.AboutImage;
  303. this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
  304.  
  305. }
  306. }
  307. private void toolBarManagerControl_onPickPushpin_Click(object sender, EventArgs e)
  308. {
  309. //wizardToolBarCMS.Show(rightPanel, 0, 0);
  310. if (toolBarManagerControl.Width == toolBarManagerControl.MinimumWidth)
  311. {
  312. toolBarManagerControl.Width = toolBarManagerControl.PreferedWidth;
  313. }
  314. else
  315. {
  316. toolBarManagerControl.Width = toolBarManagerControl.MinimumWidth;
  317. }
  318. }
  319.  
  320. private void panelSizeTsMi_Click(object sender, EventArgs e)
  321. {
  322. /*ToolStripMenuItem curTsMi = sender as ToolStripMenuItem;
  323.   foreach (ToolStripMenuItem tsMi in panelSizeTsMi.DropDownItems)
  324.   {
  325.   if (!tsMi.Equals(curTsMi))
  326.   {
  327.   ((ToolStripMenuItem)sender).Checked = false;
  328.   }
  329.   }
  330.   int width;
  331.   if( int.TryParse( ((ToolStripMenuItem)sender).Text,out width ) )
  332.   {
  333.   rightPanel.Width = width;
  334.   toolBarManagerControl.CurrentToolBar.Visible = (width > 40);
  335.   }*/
  336. }
  337. }
  338. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/view/ 
IcôneNomTailleModification
IcôneNomTailleModification
| _ Répertoire parent0 octets1713467705 18/04/2024 21:15:05
| _dialogs0 octets1541007195 31/10/2018 18:33:15
| _style0 octets1541007196 31/10/2018 18:33:16
| _utils0 octets1541007196 31/10/2018 18:33:16
| _controls0 octets1541007193 31/10/2018 18:33:13
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/view/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csDummyDoc.cs1.95 Ko31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csIMDIParent.cs2.33 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .cs|.csMDIChildForm.cs11.93 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .cs|.csSplashForm.Designer.cs4.45 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .cs|.csSourcesForm.Designer.cs8.14 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .cs|.csDummyDoc.Designer.cs6.42 Ko31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csSplashForm.cs1.02 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .cs|.csMDIParentForm.cs13.52 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .resx|.resxSplashForm.resx5.68 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .cs|.csMDIParentForm.MDIFeatures.cs14.33 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .resx|.resxMDIChildForm.resx5.68 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .cs|.csTestForm.cs350 octets31/10/2018 18:32:49-refusé-
Afficher le fichier .cs|.csSplasher.cs2.81 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .resx|.resxDummyDoc.resx7.02 Ko31/10/2018 18:32:48-refusé-
Afficher le fichier .cs|.csMDIParentForm.Designer.cs44.09 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .resx|.resxSourcesForm.resx41.87 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .cs|.csSourcesForm.cs1.83 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .cs|.csTestForm.Designer.cs1.15 Ko31/10/2018 18:32:50-refusé-
Afficher le fichier .resx|.resxMDIParentForm.resx42.14 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .cs|.csMDIChildForm.Designer.cs1.46 Ko31/10/2018 18:32:49-refusé-
Afficher le fichier .cs|.csIMDIChild.cs151 octets31/10/2018 18:32:48-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 16/10/2009, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/cs-broldev-source-rf-view/MDIParentForm.cs.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.