StyleFactory.cs
Description du code
StyleFactory.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# (StyleFactory.cs) (512 lignes)
using System; using System.Drawing; using System.Windows.Forms; using be.gaudry.model.enums; using Chaliy.Windows.Forms; namespace be.gaudry.view.style { public sealed class StyleFactory { #region declarations private ToolStripRenderer toolStripRenderer; private ProfessionalColorTable colorTable; private CustomSystemColors customSystemColors; //private ButtonRenderer buttonRenderer; private BORDER_STYLE borderStyle; private STYLE style; #endregion #region singleton // Explicit static constructor to tell C# compiler // not to mark type as beforefieldinit static StyleFactory() { } public static StyleFactory Instance { get { return instance; } } /* private static StyleFactory instance = null; private static readonly object padlock = new object(); private static StyleFactory Instance { get { lock (padlock) { if (instance == null) { instance = new StyleFactory(); } return instance; } } }*/ private StyleFactory() { Console.WriteLine("new styleFactory"); borderStyle = BORDER_STYLE.Groove; initStyle(STYLE.Office2007); } #endregion #region factory properties public static void setStyle(STYLE style) { Instance.initStyle(style); } public static STYLE getStyle() { return Instance.style; } public static BORDER_STYLE BorderStyle { get { return Instance.borderStyle; } set { Instance.borderStyle = value; } } public static ToolStripRenderer ToolStripRenderer { get { return Instance.toolStripRenderer; } } public static ProfessionalColorTable ProfessionalColorTable { get { return Instance.colorTable; } } public static CustomSystemColors CustomSystemColors { get { return Instance.customSystemColors; } } /*public static void setStyle(Control control) { StyleFactory styleFactory = Instance; control.BackColor = styleFactory.customSystemColors.Control; control.ForeColor = styleFactory.customSystemColors.ControlText; }*/ #endregion #region instance public methods and properties /// <summary> /// Used to attach or detach control update methods when a modification occurs on one of the renderers. /// </summary> public event System.EventHandler onRendererChanged; #endregion #region private methods private void initStyle(STYLE style) { this.style = style; customSystemColors.ActiveBorder = SystemColors.ActiveBorder; customSystemColors.ActiveCaption = SystemColors.ActiveCaption; customSystemColors.InactiveCaption = SystemColors.InactiveCaption; customSystemColors.GradientActiveCaption = SystemColors.GradientActiveCaption; customSystemColors.ActiveCaptionText = SystemColors.ActiveCaptionText; customSystemColors.ControlLightLight = SystemColors.ControlLightLight; customSystemColors.Control = SystemColors.Control; customSystemColors.ControlText = SystemColors.ControlText; customSystemColors.Menu = SystemColors.Menu; switch (style) { case STYLE.Aero: case STYLE.Classic: case STYLE.HomeStead: case STYLE.MediaCenter: case STYLE.Metallic: case STYLE.NormalColor: break; case STYLE.Grey3D: break; case STYLE.Office2007: customSystemColors.Control = Color.LightSteelBlue; customSystemColors.ControlText = Color.DarkSlateBlue; customSystemColors.ControlLightLight = Color.WhiteSmoke; customSystemColors.ActiveBorder = Color.DarkSlateBlue; customSystemColors.GradientActiveCaption = Color.OrangeRed; customSystemColors.ActiveCaption = Color.Orange; customSystemColors.ActiveCaptionText = Color.Black; break; /*case STYLE.Orange: colorTable = new OrangeStyleColors(); toolStripRenderer = new ToolStripProfessionalRenderer(Instance.colorTable); break;*/ case STYLE.ReBar: break; default: break; } ToolStripManager.Renderer = toolStripRenderer; //forces update on all observers controls be.gaudry.observer.StaticObservable.notify( be.gaudry.observer.Notification.VERBOSE.debug, "R mod", string.Format( "New renderer : {0}", EnumHelper.GetDescription(style) ), this )); if(onRendererChanged!=null) { onRendererChanged(this, null); } } #endregion #region ProfessionalColorTable properties /* #region ButtonPressed /// <summary> /// Gets the starting color of the gradient used when the button is pressed down. /// </summary> public static Color ButtonPressedGradientBegin { get { return ColorTable.ButtonPressedGradientBegin; } } /// <summary> /// Gets the end color of the gradient used when the button is pressed down. /// </summary> public static Color ButtonPressedGradientEnd { get { return ColorTable.ButtonPressedEnd; } } /// <summary> /// Gets the middle color of the gradient used when the button is pressed down. /// </summary> public static Color ButtonPressedGradientMiddle { get { return ColorTable.ButtonPressedMiddle; } } #endregion #region ButtonSelected /// <summary> /// Gets the starting color of the gradient used when the button is selected. /// </summary> public static Color ButtonSelectedGradientBegin { get { return ColorTable.ButtonSelectedBegin; } } /// <summary> /// Gets the end color of the gradient used when the button is selected. /// </summary> public static Color ButtonSelectedGradientEnd { get { return ColorTable.ButtonSelectedEnd; } } /// <summary> /// Gets the middle color of the gradient used when the button is selected. /// </summary> public static Color ButtonSelectedGradientMiddle { get { return ColorTable.ButtonSelectedMiddle; } } /// <summary> /// Gets the border color to use with ButtonSelectedHighlight. /// </summary> public static Color ButtonSelectedHighlightBorder { get { return ColorTable.ButtonBorder; } } #endregion #region Check /// <summary> /// Gets the solid color to use when the check box is selected and gradients are being used. /// </summary> public static Color CheckBackground { get { return ColorTable.CcheckBack; } } #endregion #region Grip /// <summary> /// Gets the color to use for shadow effects on the grip or move handle. /// </summary> public static Color GripDark { get { return ColorTable.CgripDark; } } /// <summary> /// Gets the color to use for highlight effects on the grip or move handle. /// </summary> public static Color GripLight { get { return ColorTable.CgripLight; } } #endregion #region ImageMargin /// <summary> /// Gets the starting color of the gradient used in the image margin of a ToolStripDropDownMenu. /// </summary> public static Color ImageMarginGradientBegin { get { return ColorTable.CimageMargin; } } #endregion #region MenuBorder /// <summary> /// Gets the border color or a MenuStrip. /// </summary> public static Color MenuBorder { get { return ColorTable.CmenuBorder; } } #endregion #region MenuItem /// <summary> /// Gets the starting color of the gradient used when a top-level ToolStripMenuItem is pressed down. /// </summary> public static Color MenuItemPressedGradientBegin { get { return ColorTable.CtoolStripBegin; } } /// <summary> /// Gets the end color of the gradient used when a top-level ToolStripMenuItem is pressed down. /// </summary> public static Color MenuItemPressedGradientEnd { get { return ColorTable.CtoolStripEnd; } } /// <summary> /// Gets the middle color of the gradient used when a top-level ToolStripMenuItem is pressed down. /// </summary> public static Color MenuItemPressedGradientMiddle { get { return ColorTable.CtoolStripMiddle; } } /// <summary> /// Gets the starting color of the gradient used when the ToolStripMenuItem is selected. /// </summary> public static Color MenuItemSelectedGradientBegin { get { return ColorTable.CmenuItemSelectedBegin; } } /// <summary> /// Gets the end color of the gradient used when the ToolStripMenuItem is selected. /// </summary> public static Color MenuItemSelectedGradientEnd { get { return ColorTable.CmenuItemSelectedEnd; } } #endregion #region MenuStrip /// <summary> /// Gets the starting color of the gradient used in the MenuStrip. /// </summary> public static Color MenuStripGradientBegin { get { return ColorTable.CmenuToolBack; } } /// <summary> /// Gets the end color of the gradient used in the MenuStrip. /// </summary> public static Color MenuStripGradientEnd { get { return ColorTable.CmenuToolBack; } } #endregion #region OverflowButton /// <summary> /// Gets the starting color of the gradient used in the ToolStripOverflowButton. /// </summary> public static Color OverflowButtonGradientBegin { get { return ColorTable.CoverflowBegin; } } /// <summary> /// Gets the end color of the gradient used in the ToolStripOverflowButton. /// </summary> public static Color OverflowButtonGradientEnd { get { return ColorTable.CoverflowEnd; } } /// <summary> /// Gets the middle color of the gradient used in the ToolStripOverflowButton. /// </summary> public static Color OverflowButtonGradientMiddle { get { return ColorTable.CoverflowMiddle; } } #endregion #region RaftingContainer /// <summary> /// Gets the starting color of the gradient used in the ToolStripContainer. /// </summary> public static Color RaftingContainerGradientBegin { get { return ColorTable.CmenuToolBack; } } /// <summary> /// Gets the end color of the gradient used in the ToolStripContainer. /// </summary> public static Color RaftingContainerGradientEnd { get { return ColorTable.CmenuToolBack; } } #endregion #region Separator /// <summary> /// Gets the color to use to for shadow effects on the ToolStripSeparator. /// </summary> public static Color SeparatorDark { get { return ColorTable.CseparatorDark; } } /// <summary> /// Gets the color to use to for highlight effects on the ToolStripSeparator. /// </summary> public static Color SeparatorLight { get { return ColorTable.CseparatorLight; } } #endregion #region StatusStrip /// <summary> /// Gets the starting color of the gradient used on the StatusStrip. /// </summary> public static Color StatusStripGradientBegin { get { return ColorTable.CstatusStripLight; } } /// <summary> /// Gets the end color of the gradient used on the StatusStrip. /// </summary> public static Color StatusStripGradientEnd { get { return ColorTable.CstatusStripDark; } } #endregion #region ToolStrip /// <summary> /// Gets the border color to use on the bottom edge of the ToolStrip. /// </summary> public static Color ToolStripBorder { get { return ColorTable.CtoolStripBorder; } } /// <summary> /// Gets the starting color of the gradient used in the ToolStripContentPanel. /// </summary> public static Color ToolStripContentPanelGradientBegin { get { return ColorTable.CtoolStripContentEnd; } } /// <summary> /// Gets the end color of the gradient used in the ToolStripContentPanel. /// </summary> public static Color ToolStripContentPanelGradientEnd { get { return ColorTable.CmenuToolBack; } } /// <summary> /// Gets the solid background color of the ToolStripDropDown. /// </summary> public static Color ToolStripDropDownBackground { get { return ColorTable.CcontextMenuBack; } } /// <summary> /// Gets the starting color of the gradient used in the ToolStrip background. /// </summary> public static Color ToolStripGradientBegin { get { return ColorTable.CtoolStripBegin; } } /// <summary> /// Gets the end color of the gradient used in the ToolStrip background. /// </summary> public static Color ToolStripGradientEnd { get { return ColorTable.CtoolStripEnd; } } /// <summary> /// Gets the middle color of the gradient used in the ToolStrip background. /// </summary> public static Color ToolStripGradientMiddle { get { return ColorTable.CtoolStripMiddle; } } /// <summary> /// Gets the starting color of the gradient used in the ToolStripPanel. /// </summary> public static Color ToolStripPanelGradientBegin { get { return ColorTable.CmenuToolBack; } } /// <summary> /// Gets the end color of the gradient used in the ToolStripPanel. /// </summary> public static Color ToolStripPanelGradientEnd { get { return ColorTable.CmenuToolBack; } } #endregion */ #endregion } }
Structure et Fichiers du projet
Afficher/masquer...Icône | Nom | Taille | Modification |
Icône | Nom | Taille | Modification |
| _ | Répertoire parent | 0 octets | 1732283342 22/11/2024 14:49:02 |
| _ | vista | 0 octets | 1541007202 31/10/2018 18:33:22 |
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/style//StyleFactory.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.