Ejemplo n.º 1
0
        /// <summary>
        /// Called when the Add Separator menu item is clicked.
        /// </summary>
        /// <param name="sender">The source object</param>
        /// <param name="e">Event arguments</param>
        private void OnAddSep(object sender, EventArgs e)
        {
            TabStrip           strip     = (TabStrip)Component;
            PropertyDescriptor itemsDesc = DesignUtil.GetPropertyDescriptor(strip, "Items");

            if (itemsDesc != null)
            {
                // Tell the designer that we're changing the property
                RaiseComponentChanging(itemsDesc);

                // Do the change
                TabSeparator sep = new TabSeparator();
                strip.Items.Add(sep);

                // Tell the designer that we've changed the property
                RaiseComponentChanged(itemsDesc, null, null);
                UpdateDesignTimeHtml();
            }
        }
Ejemplo n.º 2
0
        internal void CreateStyle(Page Page, string RootCSS)
        {
            if (Page == null)
            {
                throw (new InvalidOperationException("Cannot access the page class"));
            }
            else if (Page.Header == null)
            {
                throw (new InvalidOperationException("Cannot access the page header. Set runat attribute of head tag to server."));
            }


            CustomStyle ul = new CustomStyle();

            ul.Style["margin"]          = "0";
            ul.Style["padding-bottom"]  = RealHeight.ToString();
            ul.Style["padding-left"]    = "0px";
            ul.Style["height"]          = "auto !important";
            ul.Style["list-style-type"] = "none";

            if (BorderStyle != System.Web.UI.WebControls.BorderStyle.NotSet && BorderStyle != System.Web.UI.WebControls.BorderStyle.None)
            {
                ul.Style["border-top"]    = "0 !important";
                ul.Style["border-left"]   = "0 !important";
                ul.Style["border-right"]  = "0 !important";
                ul.Style["border-bottom"] = BorderStyle.ToString().ToLower() + " " + BorderWidth.ToString() + " " + System.Drawing.ColorTranslator.ToHtml(BorderColor);
            }
            Page.Header.StyleSheet.CreateStyleRule(ul, null, RootCSS);

            CustomStyle li = new CustomStyle();

            li.Style["list-style-type"] = "none";
            li.Style["margin"]          = "0";
            li.Style["padding"]         = "0";
            li.Style["display"]         = "inline";
            Page.Header.StyleSheet.CreateStyleRule(li, null, RootCSS + " li");

            CustomStyle liA = new CustomStyle();

            liA.Style["float"]           = "left";
            liA.Style["line-height"]     = "14px";
            liA.Style["padding"]         = "2px 10px 2px 10px;";
            liA.Style["text-decoration"] = "none";
            liA.Style["margin-top"]      = "2px";
            if (TabSeparator.IsEmpty)
            {
                liA.Style["margin-right"] = "2px";
            }
            else
            {
                liA.Style["margin-right"] = TabSeparator.ToString();
            }

            if (!ForeColor.IsEmpty)
            {
                liA.Style["color"] = ForeColor.ToString();
            }
            Page.Header.StyleSheet.CreateStyleRule(liA, null, RootCSS + " a:link, " + RootCSS + " a:visited, " + RootCSS + " span");
            if (!_TabStyle.IsEmpty)
            {
                Page.Header.StyleSheet.CreateStyleRule(_TabStyle, null, RootCSS + " a:link, " + RootCSS + " a:visited, " + RootCSS + " span");
            }


            CustomStyle liAselected = new CustomStyle();

            liAselected.Style["padding"]    = "4px 10px 2px 10px;";
            liAselected.Style["margin-top"] = "0px";

            if (_SelectedTabStyle.BorderStyle == System.Web.UI.WebControls.BorderStyle.NotSet || _SelectedTabStyle.BorderStyle == System.Web.UI.WebControls.BorderStyle.None)
            {
                if (!SelectedTabBackColor.IsEmpty)
                {
                    liAselected.Style["border-bottom"] = "solid 1px " + System.Drawing.ColorTranslator.ToHtml(SelectedTabBackColor);
                }
                else
                {
                    liAselected.Style["border-bottom"] = "solid 1px white";
                }

                /*
                 * .Style("border-bottom") = _SelectedTabStyle.BorderStyle.ToString().ToLower() & " " & _SelectedTabStyle.BorderWidth.ToString() & " " & Drawing.ColorTranslator.ToHtml(_SelectedTabStyle.BorderColor)
                 */
            }
            Page.Header.StyleSheet.CreateStyleRule(liAselected, null, RootCSS + " li.selected a:link, " + RootCSS + " li.selected a:visited, " + RootCSS + " li.selected span");
            if (!_SelectedTabStyle.IsEmpty)
            {
                Page.Header.StyleSheet.CreateStyleRule(_SelectedTabStyle, null, RootCSS + " li.selected a:link, " + RootCSS + " li.selected a:visited, " + RootCSS + " li.selected span");
            }
        }