Beispiel #1
0
    // Report control state of a tree of splitters

    static public string SplitterTreeState(this SplitContainer sc, string cur, Func <Control, string> getpara)
    {
        string state = sc.Orientation == Orientation.Horizontal ? "H( " : "V( ";

        state += sc.GetSplitterDistance().ToStringInvariant("0.##") + ", ";

        SplitContainer one = sc.Panel1.Controls[0] as SplitContainer;

        if (one != null)
        {
            string substate = SplitterTreeState(one, "", getpara);
            state = state + substate;
        }
        else
        {
            state += "U'" + getpara(sc.Panel1.Controls[0]) + "'";
        }

        state += ", ";
        SplitContainer two = sc.Panel2.Controls[0] as SplitContainer;

        if (two != null)
        {
            string substate = SplitterTreeState(two, "", getpara);
            state = state + substate;
        }
        else
        {
            state += "U'" + getpara(sc.Panel2.Controls[0]) + "'";
        }

        state += ") ";

        return(state);
    }
Beispiel #2
0
        private void toolStripOrientation_Click(object sender, EventArgs e)
        {
            double sdist = currentsplitter.GetSplitterDistance();

            currentsplitter.Orientation = currentsplitter.Orientation == Orientation.Horizontal ? Orientation.Vertical : Orientation.Horizontal;
            currentsplitter.SplitterDistance(sdist);
        }