Example #1
0
        public ActionResult AddStyle(FormCollection collection)
        {
            if (System.Web.HttpContext.Current.Session["admin"] != null && System.Web.HttpContext.Current.Session["admin"].ToString() == "iamadmin" && collection != null)
            {
                var titleColor   = collection["titleColor"];
                var contextColor = collection["contextColor"];
                var panelColor   = collection["backgroundColor"];
                var titleFont    = collection["titleFont"];
                var contextFont  = collection["contextFont"];
                var styleName    = collection["styleName"];

                var ps = new PanelStyle()
                {
                    StyleName = styleName,
                    color_panel_background    = panelColor,
                    color_panel_context       = contextColor,
                    color_panel_title         = titleColor,
                    font_family_panel_context = contextFont,
                    font_family_panel_title   = titleFont,
                    PageSettingId             = this.rc.Style.ThisPageId
                };
                var psm = new PanelStyleManagement();
                psm.AddPanelStyle(ps);

                this.rc.ClearStyleCache();
                return(this.RedirectToAction("AdminHome", "Admin"));
            }
            else
            {
                return(this.RedirectToAction("AdminLogOn", "Admin"));
            }
        }
Example #2
0
        public static void SetPanelProperties(Control.ControlCollection controls, PanelStyle panelStyle, PanelColors panelColors)
        {
            if (panelColors == null)
            {
                throw new ArgumentNullException("panelColors", string.Format(CultureInfo.InvariantCulture, Resources.IDS_ArgumentException, new object[1]
                {
                    "panelColors"
                }));
            }
            ArrayList arrayList = FindPanels(searchAllChildren: true, controls);

            foreach (BasePanel item in arrayList)
            {
                item.PanelStyle   = panelStyle;
                panelColors.Panel = item;
                item.SetPanelProperties(panelColors);
            }
            ArrayList arrayList2 = FindPanelLists(searchAllChildren: true, controls);

            foreach (XPanderPanelList item2 in arrayList2)
            {
                item2.PanelStyle  = panelStyle;
                item2.PanelColors = panelColors;
            }
        }
Example #3
0
        /// <summary>
        /// Sets the PanelStyle and PanelColors table in the given control collection.
        /// </summary>
        /// <param name="controls">A collection of child controls</param>
        /// <param name="panelStyle">Style of the panel</param>
        /// <param name="panelColors">The PanelColors table</param>
        public static void SetPanelProperties(Control.ControlCollection controls, PanelStyle panelStyle, PanelColors panelColors)
        {
            if (panelColors == null)
            {
                throw new ArgumentNullException("panelColors",
                                                string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                              XiaoCai.WinformUI.Properties.Resources.IDS_ArgumentException,
                                                              "panelColors"));
            }

            ArrayList panels = FindPanels(true, controls);

            foreach (BasePanel panel in panels)
            {
                panel.PanelStyle  = panelStyle;
                panelColors.Panel = panel;
                panel.SetPanelProperties(panelColors);
            }
            ArrayList PanderPanelListWs = FindPanelLists(true, controls);

            foreach (PanderPanelListW PanderPanelListW in PanderPanelListWs)
            {
                PanderPanelListW.PanelStyle  = panelStyle;
                PanderPanelListW.PanelColors = panelColors;
            }
        }
Example #4
0
        public static void SetPanelProperties(Control.ControlCollection controls, PanelStyle panelStyle, PanelColors panelColors)
        {
            if (panelColors == null)
            {
                throw new ArgumentNullException("panelColors",
                                                string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                              StaticResource.IDS_ArgumentException,
                                                              "panelColors"));
            }

            ArrayList panels = FindPanels(true, controls);

            foreach (BasePanel panel in panels)
            {
                panel.PanelStyle  = panelStyle;
                panelColors.Panel = panel;
                panel.SetPanelProperties(panelColors);
            }
            ArrayList expondPanelLists = FindPanelLists(true, controls);

            foreach (ExpondPanelList expondPanelList in expondPanelLists)
            {
                expondPanelList.PanelStyle  = panelStyle;
                expondPanelList.PanelColors = panelColors;
            }
        }
Example #5
0
        /// <summary>
        /// Sets the PanelStyle and PanelColors table in the given control collection.
        /// </summary>
        /// <param name="controls">A collection of child controls</param>
        /// <param name="panelStyle">Style of the panel</param>
        /// <param name="panelColors">The PanelColors table</param>
        public static void SetPanelProperties(Control.ControlCollection controls, PanelStyle panelStyle, PanelColors panelColors)
        {
            if (panelColors == null)
            {
                throw new ArgumentNullException("panelColors",
                                                string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                              Demo.WindowsForms.Properties.Resources.IDS_ArgumentException,
                                                              "panelColors"));
            }

            var panels = FindPanels(true, controls);

            foreach (BasePanel panel in panels)
            {
                panel.PanelStyle  = panelStyle;
                panelColors.Panel = panel;
                panel.SetPanelProperties(panelColors);
            }
            var xpanderPanelLists = FindPanelLists(true, controls);

            foreach (XPanderPanelList xpanderPanelList in xpanderPanelLists)
            {
                xpanderPanelList.PanelStyle  = panelStyle;
                xpanderPanelList.PanelColors = panelColors;
            }
        }
        /// <summary>
        /// Gets the color of the panel.
        /// </summary>
        /// <param name="panelStyle">The panel style.</param>
        /// <returns>The color of the panel</returns>
        public static Color GetPanelColor(PanelStyle panelStyle)
        {
            var palette = GetCurrentPalette();

            var contentBackColour     = Color.WhiteSmoke;
            var backgroundBackColour  = Color.White;
            var buttonStripBackColour = SystemColors.ControlDark;

            if (palette == PaletteMode.Office2007Black ||
                palette == PaletteMode.Office2007Blue ||
                palette == PaletteMode.Office2007Silver)
            {
                contentBackColour    = Color.WhiteSmoke;
                backgroundBackColour = Color.White;
                if (palette == PaletteMode.Office2007Black)
                {
                    backgroundBackColour = KryptonManager.GetPaletteForMode(palette).GetBackColor1(PaletteBackStyle.PanelAlternate, PaletteState.Normal);
                }
                buttonStripBackColour = KryptonManager.GetPaletteForMode(palette).GetBackColor1(PaletteBackStyle.PanelClient, PaletteState.Normal);
            }
            else if (palette == PaletteMode.ProfessionalOffice2003 ||
                     palette == PaletteMode.ProfessionalSystem)
            {
                contentBackColour     = SystemColors.Control;
                backgroundBackColour  = Color.White;
                buttonStripBackColour = SystemColors.ControlDark;
            }
            else if (palette == PaletteMode.SparkleBlue ||
                     palette == PaletteMode.SparkleOrange ||
                     palette == PaletteMode.SparklePurple)
            {
                contentBackColour     = Color.Black;
                backgroundBackColour  = Color.FromArgb(24, 32, 48);
                buttonStripBackColour = Color.FromArgb(24, 32, 48);
            }
            else if (palette == PaletteMode.Office2010Black ||
                     palette == PaletteMode.Office2010Blue ||
                     palette == PaletteMode.Office2010Silver)
            {
                contentBackColour     = KryptonManager.GetPaletteForMode(palette).GetBackColor1(PaletteBackStyle.PanelClient, PaletteState.Normal);
                backgroundBackColour  = KryptonManager.GetPaletteForMode(palette).GetBackColor1(PaletteBackStyle.PanelAlternate, PaletteState.Normal);
                buttonStripBackColour = KryptonManager.GetPaletteForMode(palette).GetBackColor1(PaletteBackStyle.PanelAlternate, PaletteState.Normal);
            }

            if (panelStyle == PanelStyle.Content)
            {
                return(contentBackColour);
            }
            else if (panelStyle == PanelStyle.Background)
            {
                return(backgroundBackColour);
            }
            else if (panelStyle == PanelStyle.ButtonStrip)
            {
                return(buttonStripBackColour);
            }

            return(SystemColors.Control);
        }
 private void XpanderPanelPanelStyleChanged(object sender, PanelStyleChangeEventArgs e)
 {
    PanelStyle panelStyle = e.PanelStyle;
    if(panelStyle != this.m_ePanelStyle)
    {
       this.PanelStyle = panelStyle;
    }
 }
Example #8
0
 public void AddPanelStyle(PanelStyle newStyle)
 {
     using (this.ef = new CMSDbEntities())
     {
         this.ef.PanelStyles.Add(newStyle);
         this.ef.SaveChanges();
     }
 }
Example #9
0
        private static void DrawBorder(
            Graphics graphics,
            PanelStyle panelStyle,
            Rectangle panelRectangle,
            Rectangle captionRectangle,
            Color borderColor,
            Color innerBorderColor)
        {
            using (Pen borderPen = new Pen(borderColor))
            {
                if (panelStyle != PanelStyle.Aqua)
                {
                    // Draws the innerborder around the captionbar
                    Rectangle innerBorderRectangle = captionRectangle;
                    innerBorderRectangle.Width -= 1;
                    innerBorderRectangle.Offset(1, 1);
                    ControlPaint.DrawBorder(
                        graphics,
                        innerBorderRectangle,
                        innerBorderColor,
                        ButtonBorderStyle.Solid);

                    // Draws the outer border around the captionbar
                    ControlPaint.DrawBorder(
                        graphics,
                        panelRectangle,
                        borderColor,
                        ButtonBorderStyle.Solid);

                    // Draws the line below the captionbar
                    graphics.DrawLine(
                        borderPen,
                        captionRectangle.X,
                        captionRectangle.Y + captionRectangle.Height,
                        captionRectangle.Width,
                        captionRectangle.Y + captionRectangle.Height);
                }

                if ((panelStyle == PanelStyle.Aqua) && (panelRectangle.Height == captionRectangle.Height))
                {
                    return;
                }

                // Draws the border lines around the whole panel
                Rectangle panelBorderRectangle = panelRectangle;
                panelBorderRectangle.Y       = captionRectangle.Height;
                panelBorderRectangle.Height -= captionRectangle.Height + (int)borderPen.Width;
                panelBorderRectangle.Width  -= (int)borderPen.Width;
                Point[] points =
                {
                    new Point(panelBorderRectangle.X,                              panelBorderRectangle.Y),
                    new Point(panelBorderRectangle.X,                              panelBorderRectangle.Y + panelBorderRectangle.Height),
                    new Point(panelBorderRectangle.X + panelBorderRectangle.Width, panelBorderRectangle.Y + panelBorderRectangle.Height),
                    new Point(panelBorderRectangle.X + panelBorderRectangle.Width, panelBorderRectangle.Y)
                };
                graphics.DrawLines(borderPen, points);
            }
        }
Example #10
0
        private void ExpondPanelPanelStyleChanged(object sender, PanelStyleChangeEventArgs e)
        {
            PanelStyle panelStyle = e.PanelStyle;

            if (panelStyle != this._panelStyle)
            {
                this.PanelStyle = panelStyle;
            }
        }
        /// <summary>
        /// Gets the color of the panel.
        /// </summary>
        /// <param name="panelStyle">The panel style.</param>
        /// <returns>The color of the panel</returns>
        public static Color GetPanelColor(PanelStyle panelStyle)
        {
            var palette = GetCurrentPalette();

            Color contentBackColour = Color.WhiteSmoke;
            Color backgroundBackColour = Color.White;
            Color buttonStripBackColour = SystemColors.ControlDark;

            if (palette == PaletteMode.Office2007Black
                || palette == PaletteMode.Office2007Blue
                || palette == PaletteMode.Office2007Silver)
            {
                contentBackColour = Color.WhiteSmoke;
                backgroundBackColour = Color.White;
                if (palette == PaletteMode.Office2007Black) backgroundBackColour = KryptonManager.GetPaletteForMode(palette).GetBackColor1(PaletteBackStyle.PanelAlternate, PaletteState.Normal);
                buttonStripBackColour = KryptonManager.GetPaletteForMode(palette).GetBackColor1(PaletteBackStyle.PanelClient, PaletteState.Normal);
            }
            else if (palette == PaletteMode.ProfessionalOffice2003
                || palette == PaletteMode.ProfessionalSystem)
            {
                contentBackColour = SystemColors.Control;
                backgroundBackColour = Color.White;
                buttonStripBackColour = SystemColors.ControlDark;
            }
            else if (palette == PaletteMode.SparkleBlue
                || palette == PaletteMode.SparkleOrange
                || palette == PaletteMode.SparklePurple)
            {
                contentBackColour = Color.Black;
                backgroundBackColour = Color.FromArgb(24, 32, 48);
                buttonStripBackColour = Color.FromArgb(24, 32, 48);
            }
            else if (palette == PaletteMode.Office2010Black
                || palette == PaletteMode.Office2010Blue
                || palette == PaletteMode.Office2010Silver)
            {
                contentBackColour = KryptonManager.GetPaletteForMode(palette).GetBackColor1(PaletteBackStyle.PanelClient, PaletteState.Normal);
                backgroundBackColour = KryptonManager.GetPaletteForMode(palette).GetBackColor1(PaletteBackStyle.PanelAlternate, PaletteState.Normal);
                buttonStripBackColour = KryptonManager.GetPaletteForMode(palette).GetBackColor1(PaletteBackStyle.PanelAlternate, PaletteState.Normal);
            }

            if (panelStyle == PanelStyle.Content)
            {
                return contentBackColour;
            }
            else if (panelStyle == PanelStyle.Background)
            {
                return backgroundBackColour;
            }
            else if (panelStyle == PanelStyle.ButtonStrip)
            {
                return buttonStripBackColour;
            }

            return SystemColors.Control;
        }
 /// <summary>
 /// Sets the PanelStyle in the given control collection.
 /// </summary>
 /// <param name="controls">a collection of child controls</param>
 /// <param name="panelStyle">Style of the panel</param>
 public static void SetPanelProperties(Control.ControlCollection controls, PanelStyle panelStyle)
 {
     ArrayList panels = FindPanels(true, controls);
     if (panels != null)
     {
         foreach (BasePanel panel in panels)
         {
             panel.PanelStyle = panelStyle;
         }
     }
 }
Example #13
0
        /// <summary>
        /// Sets the PanelStyle in the given control collection.
        /// </summary>
        /// <param name="controls">a collection of child controls</param>
        /// <param name="panelStyle">Style of the panel</param>
        public static void SetPanelProperties(Control.ControlCollection controls, PanelStyle panelStyle)
        {
            ArrayList panels = FindPanels(true, controls);

            if (panels != null)
            {
                foreach (BasePanel panel in panels)
                {
                    panel.PanelStyle = panelStyle;
                }
            }
        }
Example #14
0
        public static void SetPanelProperties(Control.ControlCollection controls, PanelStyle panelStyle)
        {
            ArrayList arrayList = FindPanels(searchAllChildren: true, controls);

            if (arrayList != null)
            {
                foreach (BasePanel item in arrayList)
                {
                    item.PanelStyle = panelStyle;
                }
            }
        }
Example #15
0
        public static void SetPanelProperties(Control.ControlCollection controls, PanelColors panelColors)
        {
            if (panelColors == null)
            {
                throw new ArgumentNullException("panelColors", string.Format(CultureInfo.InvariantCulture, Resources.IDS_ArgumentException, new object[1]
                {
                    "panelColors"
                }));
            }
            PanelStyle panelStyle = panelColors.PanelStyle;

            SetPanelProperties(controls, panelStyle, panelColors);
        }
        /// <summary>
        /// Sets the PanelStyle and PanelColors table in the given control collection.
        /// </summary>
        /// <param name="controls">A collection of child controls.</param>
        /// <param name="panelColors">The PanelColors table</param>
        public static void SetPanelProperties(System.Windows.Forms.Control.ControlCollection controls, PanelColors panelColors)
        {
            if (panelColors == null)
            {
                throw new ArgumentNullException("panelColors",
                                                string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                              Com.GainWinSoft.Common.Control.XAccordionPanel.Properties.Resources.IDS_ArgumentException,
                                                              "panelColors"));
            }

            PanelStyle panelStyle = panelColors.PanelStyle;

            SetPanelProperties(controls, panelStyle, panelColors);
        }
Example #17
0
        /// <summary>
        /// Sets the PanelStyle and PanelColors table in the given control collection.
        /// </summary>
        /// <param name="controls">A collection of child controls.</param>
        /// <param name="panelColors">The PanelColors table</param>
        public static void SetPanelProperties(Control.ControlCollection controls, PanelColors panelColors)
        {
            if (panelColors == null)
            {
                throw new ArgumentNullException("panelColors",
                                                string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                              XiaoCai.WinformUI.Properties.Resources.IDS_ArgumentException,
                                                              "panelColors"));
            }

            PanelStyle panelStyle = panelColors.PanelStyle;

            SetPanelProperties(controls, panelStyle, panelColors);
        }
Example #18
0
 public override void GetAllScoreObject(ref List <ScoreObject> listScoreObjects)
 {
     base.GetAllScoreObject(ref listScoreObjects);
     if (TitleStyle != null)
     {
         listScoreObjects.Add(TitleStyle);
         TitleStyle.GetAllScoreObject(ref listScoreObjects);
     }
     if (PanelStyle != null)
     {
         listScoreObjects.Add(PanelStyle);
         PanelStyle.GetAllScoreObject(ref listScoreObjects);
     }
 }
Example #19
0
        public override string Render()
        {
            string styleStr = "width:{0};height:{1};".FormatTo(Width, Height);

            if (!this.Attributes.ContainsKey("style"))
            {
                this.Attributes["style"] = styleStr;
            }
            else
            {
                this.Attributes["style"] += styleStr;
            }
            CssClass += " panels-" + PanelStyle.ToString().ToLower();
            return(base.Render());
        }
Example #20
0
        public ActionResult EditStyle(FormCollection collection)
        {
            if (System.Web.HttpContext.Current.Session["admin"] != null && System.Web.HttpContext.Current.Session["admin"].ToString() == "iamadmin" && collection != null)
            {
                var id  = Convert.ToInt32(collection["thisId"], CultureInfo.CurrentCulture);
                var psm = new PanelStyleManagement();
                switch (collection["submit"])
                {
                case "Save":
                    var titleColor   = collection["titleColor"];
                    var contextColor = collection["contextColor"];
                    var panelColor   = collection["backgroundColor"];
                    var titleFont    = collection["titleFont"];
                    var contextFont  = collection["contextFont"];
                    var styleName    = collection["styleName"];

                    var newStyle = new PanelStyle()
                    {
                        color_panel_background    = panelColor,
                        color_panel_context       = contextColor,
                        color_panel_title         = titleColor,
                        font_family_panel_context = contextFont,
                        font_family_panel_title   = titleFont,
                        StyleName = styleName
                    };
                    psm.UpdatePanelStyle(newStyle, id);

                    this.rc.ClearStyleCache();
                    return(this.RedirectToAction("AdminHome", "Admin"));

                case "Delete":
                    psm.DeletePanelStyle(id);

                    this.rc.ClearStyleCache();
                    return(this.RedirectToAction("AdminHome", "Admin"));

                case "Cancel":
                    return(this.RedirectToAction("AdminHome", "Admin"));

                default:
                    throw new ArgumentNullException("collection");
                }
            }
            else
            {
                return(this.RedirectToAction("AdminLogOn", "Admin"));
            }
        }
Example #21
0
    void Page_Load(object sender, EventArgs e)
    {
        StateBag   panelState   = new StateBag();
        PanelStyle myPanelStyle = new PanelStyle(panelState);

        // Set the properties of the PanelStyle class.
        myPanelStyle.HorizontalAlign = HorizontalAlign.Center;
        myPanelStyle.ScrollBars      = ScrollBars.Both;
        myPanelStyle.Wrap            = false;
        myPanelStyle.Direction       = ContentDirection.LeftToRight;
        myPanelStyle.BackImageUrl    = @"~\images\picture.jpg";

        // Use the ApplyStyle method of the Panel control to apply
        // the settings from the myPanelStyle object.
        Panel1.ApplyStyle(myPanelStyle);
        Panel2.ApplyStyle(myPanelStyle);
    }
Example #22
0
        public override void Init()
        {
            base.Init();

            if (TitleStyle != null)
            {
                TitleStyle.ScoreObject = this;
                TitleStyle.ScoreSheet  = ScoreSheet;
                TitleStyle.Init();
            }
            if (PanelStyle != null)
            {
                PanelStyle.ScoreObject = this;
                PanelStyle.ScoreSheet  = ScoreSheet;
                PanelStyle.Init();
            }
        }
Example #23
0
        /// <summary>
        /// Sets the PanelStyle and PanelColors table in the given control collection.
        /// </summary>
        /// <param name="controls">a collection of child controls</param>
        /// <param name="panelStyle">Style of the panel</param>
        /// <param name="panelColors">The PanelColors table</param>
        public static void SetPanelProperties(Control.ControlCollection controls, PanelStyle panelStyle, PanelColors panelColors)
        {
            if (panelColors == null)
            {
                throw new ArgumentNullException("panelColors",
                    string.Format(System.Globalization.CultureInfo.InvariantCulture,
                    ACOT.Infrastructure.Controls.Properties.Resources.IDS_ArgumentException,
                    "panelColors"));
            }

            ArrayList panels = FindPanels(true, controls);
            foreach (BasePanel panel in panels)
            {
                panel.PanelStyle = panelStyle;
                panelColors.Panel = panel;
                panel.SetPanelProperties(panelColors);
            }
        }
Example #24
0
        /// <summary>
        /// Raises the PanelStyle changed event
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A PanelStyleChangeEventArgs that contains the event data.</param>
        protected virtual void OnPanelStyleChanged(object sender, PanelStyleChangeEventArgs e)
        {
            PanelStyle panelStyle = e.PanelStyle;

            if (panelStyle != PanelStyle.Aqua)
            {
                this.Padding = new System.Windows.Forms.Padding(0);
            }
            else
            {
                this.Padding = new System.Windows.Forms.Padding(3);
            }
            foreach (XPanderPanel xpanderPanel in this.XPanderPanels)
            {
                PropertyDescriptorCollection propertyDescriptorCollection = TypeDescriptor.GetProperties(xpanderPanel);
                if (propertyDescriptorCollection.Count > 0)
                {
                    PropertyDescriptor propertyDescriptorPanelStyle = propertyDescriptorCollection["PanelStyle"];
                    if (propertyDescriptorPanelStyle != null)
                    {
                        propertyDescriptorPanelStyle.SetValue(xpanderPanel, panelStyle);
                    }
                    PropertyDescriptor propertyDescriptorLeft = propertyDescriptorCollection["Left"];
                    if (propertyDescriptorLeft != null)
                    {
                        propertyDescriptorLeft.SetValue(xpanderPanel, this.Padding.Left);
                    }
                    PropertyDescriptor propertyDescriptorWidth = propertyDescriptorCollection["Width"];
                    if (propertyDescriptorWidth != null)
                    {
                        propertyDescriptorWidth.SetValue(
                            xpanderPanel,
                            this.ClientRectangle.Width
                            - this.Padding.Left
                            - this.Padding.Right);
                    }
                }
            }
            if (this.PanelStyleChanged != null)
            {
                this.PanelStyleChanged(sender, e);
            }
        }
Example #25
0
 public override void GetAllScoreObject(ref List <ScoreObject> listScoreObjects)
 {
     base.GetAllScoreObject(ref listScoreObjects);
     if (TitleStyle != null)
     {
         listScoreObjects.Add(TitleStyle);
         TitleStyle.GetAllScoreObject(ref listScoreObjects);
     }
     if (PanelStyle != null)
     {
         listScoreObjects.Add(PanelStyle);
         PanelStyle.GetAllScoreObject(ref listScoreObjects);
     }
     for (int i = 0; i < Comments.Count; i++)
     {
         var comment = Comments[i];
         listScoreObjects.Add(comment);
         comment.GetAllScoreObject(ref listScoreObjects);
     }
 }
Example #26
0
        protected virtual void OnPanelStyleChanged(object sender, PanelStyleChangeEventArgs e)
        {
            PanelStyle panelStyle = e.PanelStyle;

            base.Padding = new Padding(0);
            foreach (XPanderPanel xPanderPanel in XPanderPanels)
            {
                PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(xPanderPanel);
                if (properties.Count > 0)
                {
                    properties["PanelStyle"]?.SetValue(xPanderPanel, panelStyle);
                    properties["Left"]?.SetValue(xPanderPanel, base.Padding.Left);
                    properties["Width"]?.SetValue(xPanderPanel, base.ClientRectangle.Width - base.Padding.Left - base.Padding.Right);
                }
            }
            if (this.PanelStyleChanged != null)
            {
                this.PanelStyleChanged(sender, e);
            }
        }
Example #27
0
        public void UpdatePanelStyle(PanelStyle newStyle, int id)
        {
            if (newStyle == null || id == 1)
            {
                return;
            }

            using (this.ef = new CMSDbEntities())
            {
                var original = this.ef.PanelStyles.Find(id);
                if (original != null)
                {
                    original.color_panel_background    = newStyle.color_panel_background;
                    original.color_panel_context       = newStyle.color_panel_context;
                    original.color_panel_title         = newStyle.color_panel_title;
                    original.font_family_panel_context = newStyle.font_family_panel_context;
                    original.font_family_panel_title   = newStyle.font_family_panel_title;
                    original.StyleName = newStyle.StyleName;
                }

                this.ef.SaveChanges();
            }
        }
Example #28
0
 /// <summary>
 /// Init
 /// </summary>
 public override void Init()
 {
     base.Init();
     for (int i = 0; i < Comments.Count; i++)
     {
         Comments[i].ScoreItem  = this;
         Comments[i].ScoreSheet = ScoreSheet;
         Comments[i].OrderID    = i;
         Comments[i].Init();
     }
     if (TitleStyle != null)
     {
         TitleStyle.ScoreObject = this;
         TitleStyle.ScoreSheet  = ScoreSheet;
         TitleStyle.Init();
     }
     if (PanelStyle != null)
     {
         PanelStyle.ScoreObject = this;
         PanelStyle.ScoreSheet  = ScoreSheet;
         PanelStyle.Init();
     }
 }
Example #29
0
        /// <summary>
        /// Raises the Paint event.
        /// </summary>
        /// <param name="e">A PaintEventArgs that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            PanelStyle panelStyle = this.PanelStyle;

            if (this.m_bShowCaptionbar == false)
            {
                return;
            }

            using (UseAntiAlias antiAlias = new UseAntiAlias(e.Graphics))
            {
                Graphics graphics = e.Graphics;
                using (UseClearTypeGridFit clearTypeGridFit = new UseClearTypeGridFit(graphics))
                {
                    Rectangle   captionRectangle    = this.CaptionRectangle;
                    Color       colorGradientBegin  = this.PanelColors.PanelCaptionGradientBegin;
                    Color       colorGradientEnd    = this.PanelColors.PanelCaptionGradientEnd;
                    Color       colorGradientMiddle = this.PanelColors.PanelCaptionGradientMiddle;
                    Color       colorText           = this.PanelColors.PanelCaptionText;
                    bool        bShowXPanderPanelProfessionalStyle = this.ShowXPanderPanelProfessionalStyle;
                    ColorScheme colorSchema = this.ColorScheme;

                    if ((bShowXPanderPanelProfessionalStyle == true) &&
                        (colorSchema == ColorScheme.Professional) &&
                        (panelStyle != PanelStyle.Office2007))
                    {
                        colorGradientBegin  = this.PanelColors.XPanderPanelCaptionGradientBegin;
                        colorGradientEnd    = this.PanelColors.XPanderPanelCaptionGradientEnd;
                        colorGradientMiddle = this.PanelColors.XPanderPanelCaptionGradientMiddle;
                        colorText           = this.PanelColors.XPanderPanelCaptionText;
                    }

                    Image       image           = this.Image;
                    RightToLeft rightToLeft     = this.RightToLeft;
                    Font        captionFont     = this.CaptionFont;
                    Rectangle   clientRectangle = this.ClientRectangle;
                    string      strText         = this.Text;
                    DockStyle   dockStyle       = this.Dock;
                    bool        bExpand         = this.Expand;
                    if (this.m_imageClosePanel == null)
                    {
                        this.m_imageClosePanel = Resources.closePanel;
                    }
                    Color colorCloseIcon = this.PanelColors.PanelCaptionCloseIcon;
                    if (colorCloseIcon == Color.Empty)
                    {
                        colorCloseIcon = colorText;
                    }
                    bool bShowExpandIcon = this.ShowExpandIcon;
                    bool bShowCloseIcon  = this.ShowCloseIcon;

                    switch (panelStyle)
                    {
                    case BSE.Windows.Forms.PanelStyle.Default:
                    case PanelStyle.Office2007:
                        DrawStyleDefault(graphics,
                                         captionRectangle,
                                         colorGradientBegin,
                                         colorGradientEnd,
                                         colorGradientMiddle);
                        break;
                    }

                    DrawBorder(
                        graphics,
                        clientRectangle,
                        captionRectangle,
                        this.PanelColors.BorderColor,
                        this.PanelColors.InnerBorderColor);

                    if ((dockStyle == DockStyle.Fill) || (dockStyle == DockStyle.None) ||
                        ((bShowExpandIcon == false) && (bShowCloseIcon == false)))
                    {
                        DrawImagesAndText(
                            graphics,
                            captionRectangle,
                            CaptionSpacing,
                            this.ImageRectangle,
                            image,
                            rightToLeft,
                            captionFont,
                            colorText,
                            strText);

                        return;
                    }
                    if ((bShowExpandIcon == true) || (bShowCloseIcon == true))
                    {
                        Image imageExpandPanel = GetExpandImage(dockStyle, bExpand);

                        DrawImagesAndText(
                            graphics,
                            dockStyle,
                            CaptionSpacing,
                            captionRectangle,
                            clientRectangle,
                            this.ImageRectangle,
                            image,
                            rightToLeft,
                            bShowCloseIcon,
                            this.m_imageClosePanel,
                            colorCloseIcon,
                            ref this.RectangleCloseIcon,
                            bShowExpandIcon,
                            bExpand,
                            imageExpandPanel,
                            colorText,
                            ref this.RectangleExpandIcon,
                            captionFont,
                            colorText,
                            this.PanelColors.PanelCollapsedCaptionText,
                            strText);

                        if (this.m_imgHoverBackground == null)
                        {
                            this.m_imgHoverBackground = GetPanelIconBackground(
                                graphics,
                                this.ImageRectangle,
                                this.PanelColors.PanelCaptionSelectedGradientBegin,
                                this.PanelColors.PanelCaptionSelectedGradientEnd);
                        }
                        if (this.m_imgHoverBackground != null)
                        {
                            Rectangle rectangleCloseIcon = this.RectangleCloseIcon;
                            if (rectangleCloseIcon != Rectangle.Empty)
                            {
                                if (this.HoverStateCloseIcon == HoverState.Hover)
                                {
                                    graphics.DrawImage(this.m_imgHoverBackground, rectangleCloseIcon);
                                    DrawIcon(graphics, this.m_imageClosePanel, rectangleCloseIcon, colorCloseIcon, rectangleCloseIcon.Y);
                                }
                            }
                            Rectangle rectangleExpandIcon = this.RectangleExpandIcon;
                            if (rectangleExpandIcon != Rectangle.Empty)
                            {
                                if (this.HoverStateExpandIcon == HoverState.Hover)
                                {
                                    graphics.DrawImage(this.m_imgHoverBackground, rectangleExpandIcon);
                                    DrawIcon(graphics, imageExpandPanel, rectangleExpandIcon, colorText, rectangleExpandIcon.Y);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #30
0
        /// <summary>
        /// Draws the text and image objects at the specified location.
        /// </summary>
        /// <param name="graphics">The Graphics to draw on.</param>
        /// <param name="panelStyle">The style of the panel.</param>
        /// <param name="dockStyle">Specifies the position and manner in which a control is docked.</param>
        /// <param name="iSpacing">The spacing on a panel's caption</param>
        /// <param name="captionRectangle">The rectangle of the panel's caption bar.</param>
        /// <param name="panelRectangle">The rectangle that represents the client area of the panel.</param>
        /// <param name="imageRectangle">The rectangle of an image displayed on a panel's caption.</param>
        /// <param name="image">The image that is displayed on a panel's caption.</param>
        /// <param name="rightToLeft">A value indicating whether control's elements are aligned to support locales using right-to-left fonts.</param>
        /// <param name="bShowCloseIcon">A value indicating whether the close image is displayed</param>
        /// <param name="imageClosePanel">The close image that is displayed on a panel's caption.</param>
        /// <param name="foreColorCloseIcon">The foreground color of the close image that is displayed on a panel's caption.</param>
        /// <param name="rectangleImageClosePanel">The rectangle of the close image that is displayed on a panel's caption.</param>
        /// <param name="bShowExpandIcon">A value indicating whether the expand image is displayed</param>
        /// <param name="bIsExpanded">A value indicating whether the panel is expanded or collapsed</param>
        /// <param name="imageExandPanel">The expand image that is displayed on a panel's caption.</param>
        /// <param name="foreColorExpandPanel">The foreground color of the expand image displayed by this caption.</param>
        /// <param name="rectangleImageExandPanel"></param>
        /// <param name="fontCaption">The font of the text displayed on a panel's caption.</param>
        /// <param name="captionForeColor">The foreground color of the text displayed on a panel's caption.</param>
        /// <param name="collapsedForeColor"></param>
        /// <param name="strCaptionText">The text which is associated with this caption.</param>
        protected static void DrawImagesAndText(
            Graphics graphics, 
            PanelStyle panelStyle,
			DockStyle dockStyle,
            int iSpacing,
            Rectangle captionRectangle,
			Rectangle panelRectangle,
            Rectangle imageRectangle,
			Image image,
			RightToLeft rightToLeft,
            bool bShowCloseIcon,
            Image imageClosePanel,
            Color foreColorCloseIcon,
            ref Rectangle rectangleImageClosePanel,
            bool bShowExpandIcon,
            bool bIsExpanded, 
            Image imageExandPanel, 
            Color foreColorExpandPanel, 
            ref Rectangle rectangleImageExandPanel,
			Font fontCaption,
            Color captionForeColor, 
            Color collapsedForeColor,
			string strCaptionText)
        {
            bool bDrawBackground = false;
            if (panelStyle == PanelStyle.Aqua)
            {
                bDrawBackground = true;
            }

            switch (dockStyle)
            {
                case DockStyle.Left:
                case DockStyle.Right:
                    if (bIsExpanded == true)
                    {
                        DrawImagesAndText(
                        graphics,
                        captionRectangle,
                        iSpacing,
                        imageRectangle,
                        image,
                        rightToLeft,
                        bDrawBackground,
                        true,
                        bShowCloseIcon,
                        imageClosePanel,
                        foreColorCloseIcon,
                        ref rectangleImageClosePanel,
                        bShowExpandIcon,
                        imageExandPanel,
                        foreColorExpandPanel,
                        ref rectangleImageExandPanel,
                        fontCaption,
                        captionForeColor,
                        strCaptionText);
                    }
                    else
                    {
                        rectangleImageClosePanel = Rectangle.Empty;
                        DrawVerticalImagesAndText(
                            graphics,
                            captionRectangle,
                            panelRectangle,
                            imageRectangle,
                            dockStyle,
                            image,
                            rightToLeft,
                            bDrawBackground,
                            imageExandPanel,
                            foreColorExpandPanel,
                            ref rectangleImageExandPanel,
                            fontCaption,
                            collapsedForeColor,
                            strCaptionText);
                    }
                    break;
                case DockStyle.Top:
                case DockStyle.Bottom:
                    DrawImagesAndText(
                        graphics,
                        captionRectangle,
                        iSpacing,
                        imageRectangle,
                        image,
                        rightToLeft,
                        bDrawBackground,
                        true,
                        bShowCloseIcon,
                        imageClosePanel,
                        foreColorCloseIcon,
                        ref rectangleImageClosePanel,
                        bShowExpandIcon,
                        imageExandPanel,
                        foreColorExpandPanel,
                        ref rectangleImageExandPanel,
                        fontCaption,
                        captionForeColor,
                        strCaptionText);
                    break;
            }
        }
Example #31
0
        private void DrawCaptionbar(Graphics graphics, bool bExpand, bool bShowBorder, PanelStyle panelStyle)
        {
            Rectangle captionRectangle = this.CaptionRectangle;
             Color colorGradientBegin = this.PanelColors.XPanderPanelCaptionGradientBegin;
             Color colorGradientEnd = this.PanelColors.XPanderPanelCaptionGradientEnd;
             Color colorGradientMiddle = this.PanelColors.XPanderPanelCaptionGradientMiddle;
             Color colorText = this.PanelColors.XPanderPanelCaptionText;
             Color foreColorCloseIcon = this.PanelColors.XPanderPanelCaptionCloseIcon;
             Color foreColorExpandIcon = this.PanelColors.XPanderPanelCaptionExpandIcon;
             bool bHover = this.HoverStateCaptionBar == HoverState.Hover ? true : false;

             if(this.m_imageClosePanel == null)
             {
            this.m_imageClosePanel = Resources.closePanel;
             }
             if(this.m_imageChevronUp == null)
             {
            this.m_imageChevronUp = Resources.ChevronUp;
             }
             if(this.m_imageChevronDown == null)
             {
            this.m_imageChevronDown = Resources.ChevronDown;
             }

             this.m_imageChevron = this.m_imageChevronDown;
             if(bExpand == true)
             {
            this.m_imageChevron = this.m_imageChevronUp;
             }

             if(this.m_captionStyle == CaptionStyle.Normal)
             {
            if(bHover == true)
            {
               colorGradientBegin = this.PanelColors.XPanderPanelSelectedCaptionBegin;
               colorGradientEnd = this.PanelColors.XPanderPanelSelectedCaptionEnd;
               colorGradientMiddle = this.PanelColors.XPanderPanelSelectedCaptionMiddle;
               if(bExpand == true)
               {
                  colorGradientBegin = this.PanelColors.XPanderPanelPressedCaptionBegin;
                  colorGradientEnd = this.PanelColors.XPanderPanelPressedCaptionEnd;
                  colorGradientMiddle = this.PanelColors.XPanderPanelPressedCaptionMiddle;
               }
               colorText = this.PanelColors.XPanderPanelSelectedCaptionText;
               foreColorCloseIcon = colorText;
               foreColorExpandIcon = colorText;
            }
            else
            {
               if(bExpand == true)
               {
                  colorGradientBegin = this.PanelColors.XPanderPanelCheckedCaptionBegin;
                  colorGradientEnd = this.PanelColors.XPanderPanelCheckedCaptionEnd;
                  colorGradientMiddle = this.PanelColors.XPanderPanelCheckedCaptionMiddle;
                  colorText = this.PanelColors.XPanderPanelSelectedCaptionText;
                  foreColorCloseIcon = colorText;
                  foreColorExpandIcon = colorText;
               }
            }
            if(panelStyle != PanelStyle.Office2007)
            {
               RenderDoubleBackgroundGradient(
               graphics,
               captionRectangle,
               colorGradientBegin,
               colorGradientMiddle,
               colorGradientEnd,
               LinearGradientMode.Vertical,
               false);
            }
            else
            {
               RenderButtonBackground(
                   graphics,
                   captionRectangle,
                   colorGradientBegin,
                   colorGradientMiddle,
                   colorGradientEnd);
            }
             }
             else
             {
            Color colorFlatGradientBegin = this.PanelColors.XPanderPanelFlatCaptionGradientBegin;
            Color colorFlatGradientEnd = this.PanelColors.XPanderPanelFlatCaptionGradientEnd;
            Color colorInnerBorder = this.PanelColors.InnerBorderColor;
            colorText = this.PanelColors.XPanderPanelCaptionText;
            foreColorExpandIcon = colorText;

            RenderFlatButtonBackground(graphics, captionRectangle, colorFlatGradientBegin, colorFlatGradientEnd, bHover);
            DrawInnerBorders(graphics, this);
             }

             DrawImagesAndText(
             graphics,
             captionRectangle,
             CaptionSpacing,
             this.ImageRectangle,
             this.Image,
             this.RightToLeft,
             this.m_bIsClosable,
             this.ShowCloseIcon,
             this.m_imageClosePanel,
             foreColorCloseIcon,
             ref this.RectangleCloseIcon,
             this.ShowExpandIcon,
             this.m_imageChevron,
             foreColorExpandIcon,
             ref this.RectangleExpandIcon,
             this.CaptionFont,
             colorText,
             this.Text);
        }
Example #32
0
        protected override void OnPaint(PaintEventArgs e)
        {
            PanelStyle panelStyle = PanelStyle;

            if (m_bShowCaptionbar)
            {
                using (new UseAntiAlias(e.Graphics))
                {
                    Graphics graphics = e.Graphics;
                    using (new UseClearTypeGridFit(graphics))
                    {
                        Rectangle   captionRectangle    = base.CaptionRectangle;
                        Color       colorGradientBegin  = base.PanelColors.PanelCaptionGradientBegin;
                        Color       colorGradientEnd    = base.PanelColors.PanelCaptionGradientEnd;
                        Color       colorGradientMiddle = base.PanelColors.PanelCaptionGradientMiddle;
                        Color       color = base.PanelColors.PanelCaptionText;
                        bool        showXPanderPanelProfessionalStyle = ShowXPanderPanelProfessionalStyle;
                        ColorScheme colorScheme = ColorScheme;
                        if (showXPanderPanelProfessionalStyle && colorScheme == ColorScheme.Professional && panelStyle != PanelStyle.Office2007)
                        {
                            colorGradientBegin  = base.PanelColors.XPanderPanelCaptionGradientBegin;
                            colorGradientEnd    = base.PanelColors.XPanderPanelCaptionGradientEnd;
                            colorGradientMiddle = base.PanelColors.XPanderPanelCaptionGradientMiddle;
                            color = base.PanelColors.XPanderPanelCaptionText;
                        }
                        Image       image           = base.Image;
                        RightToLeft rightToLeft     = RightToLeft;
                        Font        captionFont     = base.CaptionFont;
                        Rectangle   clientRectangle = base.ClientRectangle;
                        string      text            = Text;
                        DockStyle   dock            = Dock;
                        bool        expand          = Expand;
                        if (m_imageClosePanel == null)
                        {
                            m_imageClosePanel = Resources.closePanel;
                        }
                        Color color2 = base.PanelColors.PanelCaptionCloseIcon;
                        if (color2 == Color.Empty)
                        {
                            color2 = color;
                        }
                        bool showExpandIcon = ShowExpandIcon;
                        bool showCloseIcon  = ShowCloseIcon;
                        switch (panelStyle)
                        {
                        case PanelStyle.Default:
                        case PanelStyle.Office2007:
                            DrawStyleDefault(graphics, captionRectangle, colorGradientBegin, colorGradientEnd, colorGradientMiddle);
                            break;
                        }
                        DrawBorder(graphics, clientRectangle, captionRectangle, base.PanelColors.BorderColor, base.PanelColors.InnerBorderColor);
                        if (dock == DockStyle.Fill || dock == DockStyle.None || (!showExpandIcon && !showCloseIcon))
                        {
                            BasePanel.DrawImagesAndText(graphics, captionRectangle, 3, base.ImageRectangle, image, rightToLeft, captionFont, color, text);
                        }
                        else if (showExpandIcon || showCloseIcon)
                        {
                            Image expandImage = GetExpandImage(dock, expand);
                            BasePanel.DrawImagesAndText(graphics, dock, 3, captionRectangle, clientRectangle, base.ImageRectangle, image, rightToLeft, showCloseIcon, m_imageClosePanel, color2, ref RectangleCloseIcon, showExpandIcon, expand, expandImage, color, ref RectangleExpandIcon, captionFont, color, base.PanelColors.PanelCollapsedCaptionText, text);
                            if (m_imgHoverBackground == null)
                            {
                                m_imgHoverBackground = GetPanelIconBackground(graphics, base.ImageRectangle, base.PanelColors.PanelCaptionSelectedGradientBegin, base.PanelColors.PanelCaptionSelectedGradientEnd);
                            }
                            if (m_imgHoverBackground != null)
                            {
                                Rectangle rectangleCloseIcon = RectangleCloseIcon;
                                if (rectangleCloseIcon != Rectangle.Empty && base.HoverStateCloseIcon == HoverState.Hover)
                                {
                                    graphics.DrawImage(m_imgHoverBackground, rectangleCloseIcon);
                                    BasePanel.DrawIcon(graphics, m_imageClosePanel, rectangleCloseIcon, color2, rectangleCloseIcon.Y);
                                }
                                Rectangle rectangleExpandIcon = RectangleExpandIcon;
                                if (rectangleExpandIcon != Rectangle.Empty && base.HoverStateExpandIcon == HoverState.Hover)
                                {
                                    graphics.DrawImage(m_imgHoverBackground, rectangleExpandIcon);
                                    BasePanel.DrawIcon(graphics, expandImage, rectangleExpandIcon, color, rectangleExpandIcon.Y);
                                }
                            }
                        }
                    }
                }
            }
        }
 /// <summary>
 /// Arguments used when a PanelStyleChange event occurs.
 /// </summary>
 /// <param name="ePanelStyle">the style of the panel.</param>
 public PanelStyleChangeEventArgs(PanelStyle ePanelStyle)
 {
     this.m_ePanelStyle = ePanelStyle;
 }
Example #34
0
        private void DrawCaptionbar(Graphics graphics, bool bExpand, bool bShowBorder, PanelStyle panelStyle)
        {
            var  captionRectangle    = CaptionRectangle;
            var  colorGradientBegin  = PanelColors.XPanderPanelCaptionGradientBegin;
            var  colorGradientEnd    = PanelColors.XPanderPanelCaptionGradientEnd;
            var  colorGradientMiddle = PanelColors.XPanderPanelCaptionGradientMiddle;
            var  colorText           = PanelColors.XPanderPanelCaptionText;
            var  foreColorCloseIcon  = PanelColors.XPanderPanelCaptionCloseIcon;
            var  foreColorExpandIcon = PanelColors.XPanderPanelCaptionExpandIcon;
            bool bHover = HoverStateCaptionBar == HoverState.Hover ? true : false;

            if (_imageClosePanel == null)
            {
                _imageClosePanel = Resources.closePanel;
            }
            if (_imageChevronUp == null)
            {
                _imageChevronUp = Resources.ChevronUp;
            }
            if (_imageChevronDown == null)
            {
                _imageChevronDown = Resources.ChevronDown;
            }

            _imageChevron = _imageChevronDown;
            if (bExpand)
            {
                _imageChevron = _imageChevronUp;
            }

            if (_captionStyle == CaptionStyle.Normal)
            {
                if (bHover)
                {
                    colorGradientBegin  = PanelColors.XPanderPanelSelectedCaptionBegin;
                    colorGradientEnd    = PanelColors.XPanderPanelSelectedCaptionEnd;
                    colorGradientMiddle = PanelColors.XPanderPanelSelectedCaptionMiddle;
                    if (bExpand)
                    {
                        colorGradientBegin  = PanelColors.XPanderPanelPressedCaptionBegin;
                        colorGradientEnd    = PanelColors.XPanderPanelPressedCaptionEnd;
                        colorGradientMiddle = PanelColors.XPanderPanelPressedCaptionMiddle;
                    }
                    colorText           = PanelColors.XPanderPanelSelectedCaptionText;
                    foreColorCloseIcon  = colorText;
                    foreColorExpandIcon = colorText;
                }
                else
                {
                    if (bExpand)
                    {
                        colorGradientBegin  = PanelColors.XPanderPanelCheckedCaptionBegin;
                        colorGradientEnd    = PanelColors.XPanderPanelCheckedCaptionEnd;
                        colorGradientMiddle = PanelColors.XPanderPanelCheckedCaptionMiddle;
                        colorText           = PanelColors.XPanderPanelSelectedCaptionText;
                        foreColorCloseIcon  = colorText;
                        foreColorExpandIcon = colorText;
                    }
                }
                if (panelStyle != PanelStyle.Office2007)
                {
                    RenderDoubleBackgroundGradient(
                        graphics,
                        captionRectangle,
                        colorGradientBegin,
                        colorGradientMiddle,
                        colorGradientEnd,
                        LinearGradientMode.Vertical,
                        false);
                }
                else
                {
                    RenderButtonBackground(
                        graphics,
                        captionRectangle,
                        colorGradientBegin,
                        colorGradientMiddle,
                        colorGradientEnd);
                }
            }
            else
            {
                var colorFlatGradientBegin = PanelColors.XPanderPanelFlatCaptionGradientBegin;
                var colorFlatGradientEnd   = PanelColors.XPanderPanelFlatCaptionGradientEnd;
                var colorInnerBorder       = PanelColors.InnerBorderColor;
                colorText           = PanelColors.XPanderPanelCaptionText;
                foreColorExpandIcon = colorText;

                RenderFlatButtonBackground(graphics, captionRectangle, colorFlatGradientBegin, colorFlatGradientEnd, bHover);
                DrawInnerBorders(graphics, this);
            }

            DrawImagesAndText(
                graphics,
                captionRectangle,
                CaptionSpacing,
                ImageRectangle,
                Image,
                RightToLeft,
                _bIsClosable,
                ShowCloseIcon,
                _imageClosePanel,
                foreColorCloseIcon,
                ref RectangleCloseIcon,
                ShowExpandIcon,
                _imageChevron,
                foreColorExpandIcon,
                ref RectangleExpandIcon,
                CaptionFont,
                colorText,
                Text);
        }
Example #35
0
    public void DrawStatusPanel(Graphics eGraphics, PanelStyle style, int unitPanelHeight)
    {
        var activeTile = _unit.CurrentLocation;

        Draw.Text(eGraphics, Labels.For(LabelIndex.MovingUnits), style.Font, Colors.White, new Point(119, 10), true, true, Colors.Black,
                  1, 0);

        // Show active unit info
        var activeUnit = _game.ActiveUnit;

        Draw.Unit(eGraphics, activeUnit, false, 1, new Point(7, 27));

        // Show move points correctly
        var commonMultiplier    = _game.Rules.Cosmic.MovementMultiplier;
        var remainingFullPoints = activeUnit.MovePoints / commonMultiplier;
        var fractionalMove      = activeUnit.MovePoints % commonMultiplier;

        string moveText;

        if (fractionalMove > 0)
        {
            var gcf = Utils.GreatestCommonFactor(fractionalMove, commonMultiplier);
            moveText =
                $"{Labels.For(LabelIndex.Moves)}: {(remainingFullPoints > 0 ? remainingFullPoints : "")} {fractionalMove / gcf}/{commonMultiplier / gcf}";
        }
        else
        {
            moveText = $"{Labels.For(LabelIndex.Moves)}: {remainingFullPoints}";
        }

        Draw.Text(eGraphics, moveText, style.Font, style.FrontColor, new Point(79, 25), false, false,
                  style.BackColor, 1, 1);

        // Show other unit info
        var cityName = (activeUnit.HomeCity == null) ? Labels.For(LabelIndex.NONE) : activeUnit.HomeCity.Name;

        Draw.Text(eGraphics, cityName, style.Font, style.FrontColor, new Point(79, 43), false, false,
                  style.BackColor, 1, 1);
        Draw.Text(eGraphics, _game.GetActiveCiv.Adjective, style.Font, style.FrontColor, new Point(79, 61), false,
                  false, style.BackColor, 1, 1);
        var column = 83;

        Draw.Text(eGraphics, activeUnit.Veteran ? $"{activeUnit.Name} ({Labels.For(LabelIndex.Veteran)})" :activeUnit.Name, style.Font, style.FrontColor, new Point(5, column), false,
                  false, style.BackColor, 1, 1);
        column += 18;

        if (activeTile != null)
        {
            Draw.Text(eGraphics, $"({activeTile.Name})", style.Font, style.FrontColor, new Point(5, column),
                      false,
                      false, style.BackColor, 1, 1);

            // If road/railroad/irrigation/farmland/mine present
            var improvements = activeTile.Improvements.Select(c => new
                                                              { Imp = _game.TerrainImprovements[c.Improvement], Const = c }).ToList();

            var improvementText = string.Join(", ",
                                              improvements.Where(i => i.Imp.ExclusiveGroup != ImprovementTypes.DefenceGroup && !i.Imp.Negative)
                                              .Select(i => i.Imp.Levels[i.Const.Level].Name));

            if (!string.IsNullOrWhiteSpace(improvementText))
            {
                column += 18;
                Draw.Text(eGraphics, $"({improvementText})", style.Font, style.FrontColor,
                          new Point(5, column), false,
                          false, style.BackColor, 1, 1);
            }

            // If airbase/fortress present
            if (improvements.Any(i => i.Imp.ExclusiveGroup == ImprovementTypes.DefenceGroup))
            {
                column += 18;
                var airbaseText = string.Join(", ",
                                              improvements.Where(i => i.Imp.ExclusiveGroup == ImprovementTypes.DefenceGroup)
                                              .Select(i => i.Imp.Levels[i.Const.Level].Name));
                Draw.Text(eGraphics, $"({airbaseText})", style.Font, style.FrontColor, new Point(5, column),
                          false,
                          false, style.BackColor, 1, 1);
            }

            // If pollution present
            var pollutionText = string.Join(", ",
                                            improvements.Where(i => i.Imp.Negative)
                                            .Select(i => i.Imp.Levels[i.Const.Level].Name));
            if (!string.IsNullOrWhiteSpace(pollutionText))
            {
                column += 18;
                Draw.Text(eGraphics, $"({pollutionText})", style.Font, style.FrontColor, new Point(5, column), false,
                          false,
                          style.BackColor, 1, 1);
            }

            column += 5;

            // Show info for other units on the tile
            int drawCount = 0;
            foreach (var unit in activeTile.UnitsHere.Where(u => u != activeUnit))
            {
                // First check if there is vertical space still left for drawing in panel
                if (column + 69 > unitPanelHeight)
                {
                    break;
                }

                // Draw unit
                Draw.Unit(eGraphics, unit, false, 1, new Point(7, column + 27));
                // Show other unit info
                column  += 20;
                cityName = (unit.HomeCity == null) ? Labels.For(LabelIndex.NONE) : unit.HomeCity.Name;
                Draw.Text(eGraphics, cityName, style.Font, style.FrontColor, new Point(80, column), false,
                          false,
                          style.BackColor, 1, 1);
                column += 18;
                Draw.Text(eGraphics, _game.Order2string(unit.Order), style.Font, style.FrontColor,
                          new Point(80, column),
                          false, false, style.BackColor, 1, 1);
                column += 18;
                Draw.Text(eGraphics, unit.Veteran ? $"{unit.Name} ({Labels.For(LabelIndex.Veteran)})" : unit.Name, style.Font, style.FrontColor, new Point(80, column), false,
                          false,
                          style.BackColor, 1, 1);

                //System.Diagnostics.Debug.WriteLine($"{unit.Name} drawn");

                drawCount++;
            }

            // If not all units were drawn print a message
            if (activeTile.UnitsHere.Count - 1 != drawCount)     // -1 because you must not count in active unit
            {
                column  += 22;
                moveText = activeTile.UnitsHere.Count - 1 - drawCount == 1 ? "Unit" : "Units";
                Draw.Text(eGraphics, $"({activeTile.UnitsHere.Count - 1 - drawCount} More {moveText})",
                          style.Font,
                          style.FrontColor, new Point(9, column), false, false, style.BackColor, 1, 1);
            }
        }
    }
Example #36
0
        private static void DrawBorder(
			Graphics graphics,
			PanelStyle panelStyle,
			Rectangle panelRectangle,
			Rectangle captionRectangle,
            Color borderColor,
			Color innerBorderColor)
        {
            using (Pen borderPen = new Pen(borderColor))
            {
                if (panelStyle != XPanderControls.PanelStyle.Aqua)
                {
                    // Draws the innerborder around the captionbar
                    Rectangle innerBorderRectangle = captionRectangle;
                    innerBorderRectangle.Width -= 1;
                    innerBorderRectangle.Offset(1, 1);
                    ControlPaint.DrawBorder(
                        graphics,
                        innerBorderRectangle,
                        innerBorderColor,
                        ButtonBorderStyle.Solid);

                    // Draws the outer border around the captionbar
                    ControlPaint.DrawBorder(
                        graphics,
                        panelRectangle,
                        borderColor,
                        ButtonBorderStyle.Solid);

                    // Draws the line below the captionbar
                    graphics.DrawLine(
                        borderPen,
                        captionRectangle.X,
                        captionRectangle.Y + captionRectangle.Height,
                        captionRectangle.Width,
                        captionRectangle.Y + captionRectangle.Height);
                }

                if ((panelStyle == XPanderControls.PanelStyle.Aqua) && (panelRectangle.Height == captionRectangle.Height))
                {
                    return;
                }

                // Draws the border lines around the whole panel
                Rectangle panelBorderRectangle = panelRectangle;
                panelBorderRectangle.Y = captionRectangle.Height;
                panelBorderRectangle.Height -= captionRectangle.Height + (int)borderPen.Width;
                panelBorderRectangle.Width -= (int)borderPen.Width;
                Point[] points =
                    {
                        new Point(panelBorderRectangle.X, panelBorderRectangle.Y),
                        new Point(panelBorderRectangle.X, panelBorderRectangle.Y + panelBorderRectangle.Height),
                        new Point(panelBorderRectangle.X + panelBorderRectangle.Width ,panelBorderRectangle.Y + panelBorderRectangle.Height),
                        new Point(panelBorderRectangle.X + panelBorderRectangle.Width ,panelBorderRectangle.Y)
                    };
                graphics.DrawLines(borderPen, points);
            }
        }
Example #37
0
 private void PanelStylesSelectedValueChanged(object sender, EventArgs e)
 {
     if (this.m_cboPanelStyle.SelectedValue != null)
     {
         PanelStyle panelStyle = (PanelStyle)this.m_cboPanelStyle.SelectedValue;
         if (panelStyle != PanelStyle.None)
         {
             this.m_panelStyle = panelStyle;
             if (this.m_panelColors == null)
             {
                 PanelSettingsManager.SetPanelProperties(
                     this.Controls,
                     this.m_panelStyle);
             }
             else
             {
                 PanelSettingsManager.SetPanelProperties(
                     this.Controls,
                     this.m_panelStyle,
                     this.m_panelColors);
             }
         }
     }
 }
Example #38
0
 /// <summary>
 /// Arguments used when a PanelStyleChange event occurs.
 /// </summary>
 /// <param name="ePanelStyle">the style of the panel.</param>
 public PanelStyleChangeEventArgs(PanelStyle ePanelStyle)
 {
     this.m_ePanelStyle = ePanelStyle;
 }