Home
Options

Display ouput panels vertically

Hi, it is possible to display output panels (for example: winforms output panel and results panel or wpf output and results) vertically one bellow the other? I would like to dump some winform controls (panel or list of buttons or whatever) and bellow its output panel I want to see the results panel for standard dumps.. Is there some solution how to do that or, if not, it is possible to implement this feature in near future?

Comments

  • Options
    This is not possible out of the box. However, you could write a method in My Extensions to accomplish this. Something like this:
    public static class MyExtensions
    {	
    	static WebBrowser _browser;
    	static Panel _winFormsPanel;
    	static TextWriter _formatter;
    
    	public static T DumpMixed<T> (this T toDump)
    	{
    		var panel = PanelManager.GetOutputPanel ("Mixed");
    		bool first = panel == null;
    		if (first)
    		{
    			var table = new TableLayoutPanel();
    			
    			table.RowStyles.Add (new RowStyle (SizeType.Percent, 50));
    			table.RowStyles.Add (new RowStyle (SizeType.Percent, 50));
    			
    			table.ColumnStyles.Add (new ColumnStyle (SizeType.Percent, 100));
    			
    			_browser = new WebBrowser() { Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom };
    			_winFormsPanel = new Panel() { Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom };
    			
    			table.Controls.Add (_browser, 0, 0);
    			table.Controls.Add (_winFormsPanel, 0, 1);
    			
    			PanelManager.DisplayControl (table, "Mixed");
    			
    			_formatter = Util.CreateXhtmlWriter (true);
    			
    			bool init = true;
    			_browser.DocumentCompleted += (sender, args) =>
    			{
    				if (init) _browser.DocumentText = _formatter.ToString();
    				init = false;
    			};
    		}
    
    		if (toDump is Control c)
    		{
    			c.Dock = DockStyle.Fill;
    			c.Parent = _winFormsPanel;
    			return toDump;
    		}
    
    		_formatter.WriteLine (toDump);
    
    		if (first || _browser.ReadyState == System.Windows.Forms.WebBrowserReadyState.Complete)
    			_browser.DocumentText = _formatter.ToString();
    
    		return toDump;
    	}
    }
  • Options
    Thank you very much, I will try it out.. Anyway, I've one more question about Dump() rendering: I suppose, that the standard results panel contains winforms WebBrowser control for Dump() output rendering.. If so, would it be possible to somehow set its ObjectForScripting property? I know, I can write my own output panel containing WebBrowser control and use it, but I think, it will be better if this can be done through default results output panel.. thx..
  • Options
    With this solution, you won't be able to redirect the ObjectForScripting.
Sign In or Register to comment.