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
Code c# (MDIParentForm.cs) (338 lignes)
using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; using be.gaudry.model.enums; using be.gaudry.view.controls; using be.gaudry.view.dialogs; using be.gaudry.view.style; namespace be.gaudry.view { public partial class MDIParentForm : Form, IMDIParent { #region declarations and constructors //private Dictionary<STYLE,ToolStripRenderer>renderers; private ToolBarHomeControl toolBarHome; private STYLE style; public MDIParentForm() { //renderers = new Dictionary<STYLE,ToolStripRenderer>(); //todo : get style from settings style = STYLE.Office2007; //StyleFactory.setStyle(style);//default style Splasher.Status = "Initialisation des composants"; this.InitializeComponent(); resetStatusStrip(); addToolBars(); Splasher.Status = "Initialisation des styles"; initRenderers(); /* this.DataBindings.Add(new System.Windows.Forms.Binding("Location", global::be.gaudry.Properties.Settings.Default, "mainFormLocation", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); this.DataBindings.Add(new System.Windows.Forms.Binding("WindowState", global::be.gaudry.Properties.Settings.Default, "mainFormWindowState", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); this.DataBindings.Add(new System.Windows.Forms.Binding("StartPosition", global::be.gaudry.Properties.Settings.Default, "mainFormStartPosition", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); this.DataBindings.Add(new System.Windows.Forms.Binding("ClientSize", global::be.gaudry.Properties.Settings.Default, "mainFormClientSize", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); */ } private void addToolBars() { toolBarManagerControl.addToolBar(toolBarHome); } #endregion #region misc menu methods private void exitTsMi_Click(object sender, EventArgs e) { this.Close(); //Application.Exit(); } private void sourcesTsMi_Click(object sender, EventArgs e) { showMDIChild<SourcesForm>(); } protected void showOnlineHelp_Click(object sender, EventArgs e) { showMDIChild<InfobrolForm>(); } private void updateTsMi_Click(object sender, EventArgs e) { showMDIChild<UpdateDialog>(); } /// <summary> /// Override it to show another about box /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void showAboutBox_Click(object sender, EventArgs e) { } /// <summary> /// Override it to show some options /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void showOptions_Click(object sender, EventArgs e) { MessageBox.Show( this, "Aucune option disponible", "Options", MessageBoxButtons.OK, MessageBoxIcon.Information ); } protected void showToolBar(IToolBarControl toolBar) { if (!toolBarManagerControl.Visible) { toolBarManagerControl.Visible = true; } toolBarManagerControl.CurrentToolBar = toolBar; } private void showHideDisplayTools_Click(object sender, EventArgs e) { displayTS.Visible = !displayTS.Visible; } private void showHideAssistant_Click(object sender, EventArgs e) { toolBarManagerControl.Visible = !toolBarManagerControl.Visible; } protected void displayMenuLeftTsB_Click(object sender, EventArgs e) { leftPanel.Visible = !leftPanel.Visible; } private void showHideStatusStrip_Click(object sender, EventArgs e) { statusStrip.Visible = !statusStrip.Visible; } #endregion #region styles private void checkStyleItem(string current) { foreach (ToolStripMenuItem tsMi in customTSMenuItem.DropDownItems) { } } private void initRenderers() { //Binding of ToolStripComboBox.ComboBox does not work... Known bug in.net /* styleTsCB.ComboBox.DataSource = EnumHelper.ToList(typeof(STYLE)); styleTsCB.ComboBox.DisplayMember = "Value"; styleTsCB.ComboBox.ValueMember = "Key"; */ //add all STYLE enum items in the ComboBox { /* * We must initialize a new STYLE item to avoid than all anonym methods * share the same local variable type. * All instances of our anonym methods are executed by different thread than iterator method. * That makes all delegates have the last KeyValuePair object return by the iterator. */ STYLE style = (STYLE)kvp.Key; string text = kvp.Value; kvp.Value, null, delegate { StyleFactory.setStyle(style); //ToolStripManager.Renderer = renderers[style]; checkStyleItem(text); } ); customTSMenuItem.DropDownItems.Add(tsMi); } /* renderers.Add(STYLE.Grey3D, new ToolStripProfessionalRenderer(new ControlStyleColors())); renderers.Add(STYLE.Office2007, new Office2007Renderer.Office2007Renderer()); renderers.Add(STYLE.Orange, new ToolStripProfessionalRenderer(new OrangeStyleColors())); renderers.Add( STYLE.Aero, new ToolStripProfessionalRenderer(new ProfessionalColorTableFactory(STYLE.Aero)) ); renderers.Add( STYLE.Classic, new ToolStripProfessionalRenderer(new ProfessionalColorTableFactory(STYLE.Classic)) ); renderers.Add( STYLE.HomeStead, new ToolStripProfessionalRenderer(new ProfessionalColorTableFactory(STYLE.HomeStead)) ); renderers.Add( STYLE.MediaCenter, new ToolStripProfessionalRenderer(new ProfessionalColorTableFactory(STYLE.MediaCenter)) ); renderers.Add( STYLE.Metallic, new ToolStripProfessionalRenderer(new ProfessionalColorTableFactory(STYLE.Metallic)) ); renderers.Add( STYLE.NormalColor, new ToolStripProfessionalRenderer(new ProfessionalColorTableFactory(STYLE.NormalColor)) ); renderers.Add( STYLE.ReBar, new RebarRenderer() ); */ //defaultRenderer = new ToolStripProfessionalRenderer(); //systemRenderer = new ToolStripSystemRenderer(); } #endregion #region Windows layout menu private void dispWinCTSMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.Cascade); } private void dispWinHTSMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.TileHorizontal); } private void dispWinVTSMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.TileVertical); } private void dispWinAIconsTSMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.ArrangeIcons); } #endregion #region override of form events /// <summary> /// Sets text on splasher, /// raises the System.Windows.Forms.Form.Load event, /// loads some form's properties like position, state, size, /// and closes the splasher /// </summary> /// <param name="e">An System.EventArgs that contains the event data.</param> protected override void OnLoad(EventArgs e) { Splasher.Status = "Tentative de lecture des paramètres de la fenêtre"; base.OnLoad(e); /*try { WindowState = (FormWindowState)Enum.Parse( typeof(FormWindowState), System.Configuration.ConfigurationManager.AppSettings["mainFormState"] ); } catch (Exception) { WindowState = FormWindowState.Normal; }*/ try { this.Size = Properties.Settings.Default.mainFormClientSize; this.Location = Properties.Settings.Default.mainFormLocation; this.WindowState = Properties.Settings.Default.mainFormWindowState; this.StartPosition = Properties.Settings.Default.mainFormStartPosition; } catch{} //ToolStripManager.Renderer = StyleFactory.ToolStripRenderer;//renderers[style]; checkStyleItem(EnumHelper.GetDescription(style)); //toolBarManagerControl.CurrentToolBar = toolBarHome;//set console as current if displayed on the config //Splasher.close();//close splasher in the inherited form } /// <summary> /// Save some form's properties like position, state, size, and /// raises the System.Windows.Forms.Form.FormClosing event /// </summary> /// <param name="e">An System.EventArgs that contains the event data.</param> protected override void OnFormClosing(FormClosingEventArgs e) { //Config.saveAppSetting("mainFormState", Enum.GetName(typeof(FormWindowState), WindowState)); Properties.Settings.Default.mainFormWindowState = this.WindowState; if (this.WindowState == FormWindowState.Normal) { Properties.Settings.Default.mainFormClientSize = this.Size; Properties.Settings.Default.mainFormLocation = this.Location; } else { Properties.Settings.Default.mainFormClientSize = this.RestoreBounds.Size; Properties.Settings.Default.mainFormLocation = this.RestoreBounds.Location; } Properties.Settings.Default.mainFormStartPosition = this.StartPosition; Properties.Settings.Default.Save(); base.OnFormClosing(e); } #endregion protected Image AboutImage { get { return this.toolBarHome.AboutImage; } set { this.toolBarHome.AboutImage = value; this.BackgroundImage = toolBarHome.AboutImage; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; } } private void toolBarManagerControl_onPickPushpin_Click(object sender, EventArgs e) { //wizardToolBarCMS.Show(rightPanel, 0, 0); if (toolBarManagerControl.Width == toolBarManagerControl.MinimumWidth) { toolBarManagerControl.Width = toolBarManagerControl.PreferedWidth; } else { toolBarManagerControl.Width = toolBarManagerControl.MinimumWidth; } } private void panelSizeTsMi_Click(object sender, EventArgs e) { /*ToolStripMenuItem curTsMi = sender as ToolStripMenuItem; foreach (ToolStripMenuItem tsMi in panelSizeTsMi.DropDownItems) { if (!tsMi.Equals(curTsMi)) { ((ToolStripMenuItem)sender).Checked = false; } } int width; if( int.TryParse( ((ToolStripMenuItem)sender).Text,out width ) ) { rightPanel.Width = width; toolBarManagerControl.CurrentToolBar.Visible = (width > 40); }*/ } } }
Structure et Fichiers du projet
Afficher/masquer...Icône | Nom | Taille | Modification |
Icône | Nom | Taille | Modification |
| _ | Répertoire parent | 0 octets | 1732213017 21/11/2024 19:16:57 |
| _ | dialogs | 0 octets | 1541007195 31/10/2018 18:33:15 |
| _ | style | 0 octets | 1541007196 31/10/2018 18:33:16 |
| _ | utils | 0 octets | 1541007196 31/10/2018 18:33:16 |
| _ | controls | 0 octets | 1541007193 31/10/2018 18:33:13 |
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.
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 16/10/2009 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/cs-broldev-source-rf-view/MDIParentForm.cs.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.