mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 10:35:27 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			864 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			864 B
		
	
	
	
		
			C#
		
	
	
	
	
	
using Spectre.Console;
 | 
						|
using Spectre.Console.Json;
 | 
						|
 | 
						|
namespace Generator.Commands.Samples
 | 
						|
{
 | 
						|
    public class LayoutSample : BaseSample
 | 
						|
    {
 | 
						|
        public override (int Cols, int Rows) ConsoleSize => (80, 24);
 | 
						|
 | 
						|
        public override void Run(IAnsiConsole console)
 | 
						|
        {
 | 
						|
            var layout = new Layout("Root")
 | 
						|
                .SplitColumns(
 | 
						|
                    new Layout("Left"),
 | 
						|
                    new Layout("Right")
 | 
						|
                        .SplitRows(
 | 
						|
                            new Layout("Top"),
 | 
						|
                            new Layout("Bottom")));
 | 
						|
 | 
						|
            layout["Left"].Update(
 | 
						|
                new Panel(
 | 
						|
                    Align.Center(
 | 
						|
                        new Markup("Hello [blue]World![/]"),
 | 
						|
                        VerticalAlignment.Middle))
 | 
						|
                    .Expand());
 | 
						|
 | 
						|
            AnsiConsole.Write(layout);
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |