Geen cache-versie.

Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.

ToolBarManagerControl.cs

Description du code

ToolBarManagerControl.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.ComponentModel;
  4. using System.Drawing;
  5. using System.Windows.Forms;
  6. using be.gaudry.view.style;
  7.  
  8. namespace be.gaudry.view.controls
  9. {
  10. public partial class ToolBarManagerControl : UserControl
  11. {
  12. private Dictionary<string, IToolBarControl> toolBars;
  13. private int preferdWidth = 200, minimumWidth=25;
  14. public ToolBarManagerControl()
  15. {
  16. toolBars = new Dictionary<string, IToolBarControl>();
  17. InitializeComponent();
  18. }
  19.  
  20. #region properties
  21. [
  22. Category("Display"),
  23. Browsable(true),
  24. Description("Event called on click on the pushpin button (Auto-hide)")
  25. ]
  26. public event System.EventHandler onPickPushpin_Click;
  27.  
  28. [
  29. Category("Display"),
  30. Browsable(true),
  31. Description("Event called on click on the hide button (manual-hide)")
  32. ]
  33. public event System.EventHandler onHide_Click;
  34.  
  35. /// <summary>
  36. /// Gets or sets the <code>be.gaudry.view.controls.IToolBarControl</code> that is selected in the <code>be.gaudry.view.controls.ToolBarControlManager</code>.
  37. /// </summary>
  38. [
  39. Browsable(false),
  40. DefaultValue(null)
  41. ]
  42. public IToolBarControl CurrentToolBar
  43. {
  44. get
  45. {
  46. string currentToolBar = toolBarsICB.SelectedInnerText;
  47. if (currentToolBar!=null && toolBars.ContainsKey(currentToolBar))
  48. {
  49. return toolBars[currentToolBar];
  50. }
  51. return null;
  52. }
  53. set
  54. {
  55. toolBarsICB.SelectedInnerText = value.ToolBarText;
  56. }
  57. }
  58. /// <summary>
  59. /// Get the width of the panel.
  60. /// </summary>
  61. [
  62. Browsable(false)
  63. ]
  64. public int PreferedWidth
  65. {
  66. get { return preferdWidth; }
  67. }
  68. /// <summary>
  69. /// Get the minimum width of the panel.
  70. /// </summary>
  71. [
  72. Browsable(false)
  73. ]
  74. public int MinimumWidth
  75. {
  76. get { return minimumWidth; }
  77. }
  78. #endregion
  79.  
  80. public void addToolBar(IToolBarControl toolBar)
  81. {
  82. if (!toolBars.ContainsKey(toolBar.ToolBarText) && toolBar is Control)
  83. {
  84. ((Control)toolBar).Dock = DockStyle.Fill;
  85. toolBars.Add(toolBar.ToolBarText, toolBar);
  86. toolBarsICB.addItem(toolBar.ToolBarText, toolBar.ToolBarImage);
  87. defineGradientBackground((Control)toolBar);
  88. //(Control)toolBar.Resize += new System.EventHandler(this.ToolBarHomeControl_Resize);
  89. }
  90.  
  91. }
  92. /// <summary>
  93. /// Defines a bitmap as BackgroundImageLayout to avoid gradient background flickering on paint event
  94. /// </summary>
  95. private void defineGradientBackground(Control toolBarControl)
  96. {
  97. //todo : put this on an abstract class AbstractToolBarControl
  98. /*toolBarControl.SetStyle(ControlStyles.ResizeRedraw, true);
  99.   toolBarControl.SetStyle(ControlStyles.UserPaint, true);
  100.   toolBarControl.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
  101.   toolBarControl.SetStyle(ControlStyles.DoubleBuffer, true);
  102.   System.Drawing.Drawing2D.LinearGradientBrush gradientBrush;*/
  103. System.Drawing.Drawing2D.LinearGradientBrush gradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(new
  104. Point(0, 0),
  105. new Point(toolBarControl.Width, toolBarControl.Height),
  106. StyleFactory.CustomSystemColors.Control,
  107. StyleFactory.CustomSystemColors.ControlLightLight
  108. );
  109. Bitmap bmp = new Bitmap(toolBarControl.Width, toolBarControl.Height);
  110. Graphics g = Graphics.FromImage(bmp);
  111. g.FillRectangle(gradientBrush, new Rectangle(0, 0, toolBarControl.Width, toolBarControl.Height));
  112. toolBarControl.BackgroundImage = bmp;
  113. toolBarControl.BackgroundImageLayout = ImageLayout.Stretch;
  114. }
  115. private void toolBarsICB_SelectedIndexChanged(object sender, EventArgs e)
  116. {
  117. string currentToolBar = toolBarsICB.SelectedInnerText;
  118. if (toolBars.ContainsKey(currentToolBar))
  119. {
  120. Control toolBar = (Control)toolBars[currentToolBar];
  121. splitContainer1.Panel2.Controls.Clear();
  122. splitContainer1.Panel2.Controls.Add(toolBar);
  123. //toolBar.Dock = DockStyle.Fill;
  124. }
  125. }
  126.  
  127. private void ToolBarManagerControl_Load(object sender, EventArgs e)
  128. {
  129. if (toolBarsICB.Items.Count > 0)
  130. {
  131. toolBarsICB.SelectedIndex = 0;
  132. }
  133. }
  134.  
  135. private void autoHideButton_Click(object sender, EventArgs e)
  136. {
  137. if (onPickPushpin_Click != null)
  138. {
  139. onPickPushpin_Click(sender, e);
  140. }
  141. else
  142. {
  143. Width = (Width > minimumWidth) ? minimumWidth : preferdWidth;
  144. splitContainer1.Panel2Collapsed = (Width <= minimumWidth);
  145. }
  146. }
  147.  
  148. private void panelSizeTsMi_Click(object sender, EventArgs e)
  149. {
  150. ToolStripMenuItem curTsMi = sender as ToolStripMenuItem;
  151. foreach (ToolStripMenuItem tsMi in panelSizeTsMi.DropDownItems)
  152. {
  153. if (!tsMi.Equals(curTsMi))
  154. {
  155. ((ToolStripMenuItem)sender).Checked = false;
  156. }
  157. }
  158. int width;
  159. if (int.TryParse(((ToolStripMenuItem)sender).Text, out width))
  160. {
  161. preferdWidth = width;
  162. Width = preferdWidth;
  163. splitContainer1.Panel2Collapsed = (Width > minimumWidth);
  164. //CurrentToolBar.Visible = (width > minimumWidth);
  165. }
  166. }
  167. private void hideButton_Click(object sender, EventArgs e)
  168. {
  169. if (onHide_Click != null)
  170. {
  171. onHide_Click(sender, e);
  172. }
  173. else
  174. {
  175. this.Visible = false;
  176. }
  177. }
  178.  
  179. private void ToolBarManagerControl_MouseEnter(object sender, EventArgs e)
  180. {
  181. Width = preferdWidth;
  182. splitContainer1.Panel2Collapsed = false;
  183. }
  184.  
  185. private void ToolBarManagerControl_MouseLeave(object sender, EventArgs e)
  186. {
  187. Width = minimumWidth;
  188. splitContainer1.Panel2Collapsed = true;
  189. }
  190.  
  191. private void ToolBarManagerControl_SizeChanged(object sender, EventArgs e)
  192. {
  193. IToolBarControl control = CurrentToolBar;
  194. if(control!=null)control.PerformLayout();
  195. }
  196. }
  197. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/view/controls/ 
IcôneNomTailleModification
Pas de sous-répertoires.
IcôneNomTailleModification
| _ Répertoire parent0 octets1717793569 07/06/2024 22:52:49
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/broldev/src/view/controls/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csToolBarHomeControl.Designer.cs7.41 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csWizardUserControl.Designer.cs6.79 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csHeaderPanel.Designer.cs1.19 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csDGVLayoutOptionsControl.cs7.55 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csXPGroupBox.cs15.83 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csWizardXpUserControl.Designer.cs7.85 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csToolBarHomeControl.cs2.32 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csVersionControl.Designer.cs4.09 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csWizardUserControl.cs2.01 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .resx|.resxWizardXpUserControl.resx5.68 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csBrolBoxUserControl.Designer.cs5.92 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .resx|.resxChartControl.resx6.58 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csHeaderPanel.cs35.93 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csIWizardUC.cs2.35 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxAboutUserControl.resx5.68 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .cs|.csTextBoxDragDrop.cs8.59 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csSystemInfoControl.cs5.46 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxXPGroupBox.resx17.7 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csHeaderPanelNativeMethods.cs21.09 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csToolBarManagerControl.cs6.99 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csTextBoxDragDrop.Designer.cs1.11 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .resx|.resxSystemInfoControl.resx6.22 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csSystemInfoControl.Designer.cs4.79 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .resx|.resxHeaderPanel.resx5.85 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csScrollablePictureBoxUserControl.cs5.55 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csBrolBoxUserControl.cs4.7 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .resx|.resxDGVLayoutOptionsControl.resx5.68 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxWizardUserControl.resx5.68 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csUpdateControl.cs7.55 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csIconList.cs2.68 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csVersionControl.cs463 octets31/10/2018 18:33:12-refusé-
Afficher le fichier .resx|.resxBrolBoxUserControl.resx5.68 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .cs|.csAboutUserControl.cs6.75 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .resx|.resxToolBarManagerControl.resx5.88 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csToolBarManagerControl.Designer.cs10.66 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csIToolBarControl.cs1.07 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csWizardXpUserControl.cs8.11 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csImageCombo.cs15.49 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csAboutUserControl.Designer.cs12.31 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .resx|.resxScrollablePictureBoxUserControl.resx5.68 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csScrollablePictureBoxUserControl.Designer.cs5.64 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxVersionControl.resx5.68 Ko31/10/2018 18:33:13-refusé-
Afficher le fichier .cs|.csChartControl.Designer.cs18.45 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .cs|.csUpdateControl.Designer.cs3.92 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .resx|.resxUpdateControl.resx5.68 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csChartControl.cs15.11 Ko31/10/2018 18:33:10-refusé-
Afficher le fichier .cs|.csDGVLayoutOptionsControl.Designer.cs17.39 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .cs|.csToolStrip.cs1.06 Ko31/10/2018 18:33:12-refusé-
Afficher le fichier .cs|.csIconList.Designer.cs1.1 Ko31/10/2018 18:33:11-refusé-
Afficher le fichier .resx|.resxToolBarHomeControl.resx48.51 Ko31/10/2018 18:33:12-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.

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/controls//ToolBarManagerControl.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.