Beispiel #1
0
    private void SetupMenu()
    {
        // Calculate innerlayer max width 32 pixel per icon
        int ScrollingLayerWidth = Icons.Count * 26 + extraMenuWidth;

        WebControls.Table    Container = new WebControls.Table();
        WebControls.TableRow tr        = new WebControls.TableRow();
        Container.Rows.Add(tr);

        // // scroll-left image
        WebControls.TableCell td      = new WebControls.TableCell();
        WebControls.Image     scrollL = scrollImage();
        scrollL.ImageUrl = _ClientFilesPath + "images/arrawBack.gif";
        scrollL.Attributes.Add("onMouseOver", "this.className = 'editorArrowOver'; scrollR('" + this.ClientID + "_sl','" + this.ClientID + "_slh'," + ScrollingLayerWidth + ");");
        td.Controls.Add(scrollL);
        tr.Cells.Add(td);

        // // Menulayers
        td = new WebControls.TableCell();

        HtmlControls.HtmlGenericControl outerLayer = new HtmlControls.HtmlGenericControl();
        outerLayer.TagName = "div";
        outerLayer.ID      = this.ID + "_slh";
        outerLayer.Attributes.Add("class", "slh");
        outerLayer.Style.Add("height", "26px");
        string tmp = this.Width.ToString;

        outerLayer.Style.Add("width", (this.Width.Value - 18).ToString + "px");
        td.Controls.Add(outerLayer);

        HtmlControls.HtmlGenericControl menuLayer = new HtmlControls.HtmlGenericControl();
        menuLayer.TagName = "div";
        menuLayer.ID      = this.ID + "_sl";
        menuLayer.Style.Add("top", "0px");
        menuLayer.Style.Add("left", "0px");
        menuLayer.Attributes.Add("class", "sl");
        menuLayer.Style.Add("height", "26px");
        menuLayer.Style.Add("width", ScrollingLayerWidth + "px");

        HtmlControls.HtmlGenericControl nobr = new HtmlControls.HtmlGenericControl();
        nobr.TagName = "nobr";
        menuLayer.Controls.Add(nobr);

        // // add all icons to the menu layer
        foreach (Control item in Icons)
        {
            menuLayer.Controls.Add(item);

            if (item.ID != "")
            {
                iconIds = iconIds + item.ID + ",";
            }
        }

        outerLayer.Controls.Add(new LiteralControl("<script>" + Constants.vbCrLf + "RegisterScrollingMenuButtons('" + this.ClientID + "', '" + iconIds + "');" + Constants.vbCrLf + "</script>"));

        outerLayer.Controls.Add(menuLayer);

        tr.Cells.Add(td);

        // // scroll-right image
        td = new WebControls.TableCell();
        WebControls.Image scrollR = scrollImage();
        scrollR.ImageUrl = _ClientFilesPath + "images/arrowForward.gif";
        scrollR.Attributes.Add("onMouseOver", "this.className = 'editorArrowOver'; scrollL('" + this.ClientID + "_sl','" + this.ClientID + "_slh'," + ScrollingLayerWidth + ");");
        td.Controls.Add(scrollR);
        tr.Cells.Add(td);

        this.Controls.Add(Container);
    }