Пример #1
0
        /// <summary>Creates a new exception tree. Currently, only one is used.</summary>
        /// <param name="list">The list.</param>
        /// <returns>An exception tree</returns>
        public ExceptionTree CreateExceptionTree(IEnumerable<ThrownException> list)
        {
            if (this.exceptionTree != null)
            {
                return this.exceptionTree;
            }

            ExceptionTree tree = new ExceptionTree();
            CallStackList callStackList = new CallStackList();
            TitleBar treeTitle = new TitleBar();
            TitleBar callStackTitle = new TitleBar();
            SplitContainer split = new SplitContainer();

            tree.SuspendLayout();
            callStackList.SuspendLayout();
            treeTitle.SuspendLayout();
            callStackTitle.SuspendLayout();
            split.SuspendLayout();

            tree.CallStackList = callStackList;

            int titleHeight = 18;
            int width = this.splitContainerMaster.Panel1.ClientRectangle.Width;

            //treeTitle.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            treeTitle.Dock = DockStyle.Top;
            treeTitle.BackColor = System.Drawing.SystemColors.Control;
            treeTitle.Font = new System.Drawing.Font("Segoe UI", 9F);
            //treeTitle.Location = new System.Drawing.Point(0, this.exceptionTabStrip.Height);
            treeTitle.Name = "exceptionTreeTitle";
            treeTitle.Size = new System.Drawing.Size(width, titleHeight);
            treeTitle.TabIndex = 1;
            treeTitle.Text = "Exception Tree";
            treeTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;

            tree.BackColor = System.Drawing.SystemColors.Window;
            tree.Controller = null;
            tree.Dock = System.Windows.Forms.DockStyle.Fill;
            tree.FullRowSelect = true;
            tree.Location = new System.Drawing.Point(0, titleHeight);
            tree.Margin = new System.Windows.Forms.Padding(0);
            tree.Name = "exceptionTree";
            tree.ImageList = this.classTree.ImageList;
            tree.Size = new System.Drawing.Size(558, 154);
            tree.TabIndex = 2;

            callStackTitle.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            callStackTitle.BackColor = System.Drawing.SystemColors.Control;
            callStackTitle.Font = new System.Drawing.Font("Segoe UI", 9F);
            callStackTitle.Location = new System.Drawing.Point(0, 0);
            callStackTitle.Name = "callStackTitle";
            callStackTitle.Size = new System.Drawing.Size(width, titleHeight);
            callStackTitle.TabIndex = 1;
            callStackTitle.Text = "Call stack";
            callStackTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;

            callStackList.BackColor = System.Drawing.SystemColors.Window;
            callStackList.Controller = null;
            callStackList.Dock = System.Windows.Forms.DockStyle.Fill;
            callStackList.FullRowSelect = true;
            callStackList.GroupByType = false;
            callStackList.Location = new System.Drawing.Point(0, titleHeight);
            callStackList.Margin = new System.Windows.Forms.Padding(0);
            callStackList.Name = "callStackList";
            callStackList.OwnerDraw = true;
            callStackList.Size = new System.Drawing.Size(width, 154);
            callStackList.SmallImageList = this.images;
            callStackList.TabIndex = 2;
            callStackList.UseCompatibleStateImageBehavior = false;
            callStackList.View = System.Windows.Forms.View.Details;

            split.Name = "splitExceptions";
            split.Orientation = System.Windows.Forms.Orientation.Horizontal;

            //split.Location = new System.Drawing.Point(0, this.exceptionTabStrip.Size.Height);
            //split.Size = new System.Drawing.Size(100, this.exceptionTabStrip.ClientRectangle.Height);

            split.Panel1.Controls.Add(treeTitle);
            split.Panel1.Controls.Add(tree);
            split.Panel1.Padding = new System.Windows.Forms.Padding(0, titleHeight , 0, 0);

            split.Panel2.Controls.Add(callStackTitle);
            split.Panel2.Controls.Add(callStackList);
            split.Panel2.Padding = new System.Windows.Forms.Padding(0, titleHeight, 0, 0);

            //split.Size = new System.Drawing.Size(558, 298);
            split.SplitterDistance = 122;
            split.TabIndex = 5;

            split.Dock = DockStyle.Fill;

            this.splitContainerMaster.Panel2.Controls.Add(split);
            ////this.tablePanel.Controls.Add(split, 0, 1);
            ////this.exceptionTabStrip.ActiveTab = this.exceptionTabStrip.AddTab("hello", split);

            split.Margin = new System.Windows.Forms.Padding(0);

            tree.ResumeLayout();
            callStackList.ResumeLayout();
            treeTitle.ResumeLayout();
            callStackTitle.ResumeLayout();
            split.ResumeLayout();

            this.exceptionTreeTitle = treeTitle;
            this.callStackListTitle = callStackTitle;

            return tree;
        }