private void InitRedBox() { AssembledStyles styles = new AssembledStyles(); RootBox root = new RootBox(styles); BlockBox block = new BlockBox(styles, Color.Red, 72000, 36000); root.AddBox(block); theSharpView.Root = root; }
// Add to the root a text paragraph which reflects the SimpleText property. private void AddSimpleTextPara(AssembledStyles styles, int ws, RootBox root) { var items = new List<IClientRun>(); var run = new StringClientRun("This is the day that the Lord has made. We will rejoice and be glad in it", styles.WithWs(ws)); items.Add(run); var source = new TextSource(items); var para = new ParaBox(styles, source); var hookup = new StringHookup(this, () => this.SimpleText, hook => SimpleTextChanged += hook.StringPropChanged, hook => SimpleTextChanged -= hook.StringPropChanged, para); hookup.Writer = newVal => SimpleText = newVal; run.Hookup = hookup; root.AddBox(para); }
private void InitSeveralBoxes() { AssembledStyles styles = new AssembledStyles(); RootBox root = new RootBox(styles); var items = new List<ClientRun>(); items.Add(new BlockBox(styles, Color.Red, 72000, 36000)); items.Add(new BlockBox(styles, Color.Blue, 36000, 18000)); items.Add(new BlockBox(styles, Color.Orange, 18000, 36000)); items.Add(new BlockBox(styles, Color.Green, 72000, 18000)); items.Add(new BlockBox(styles, Color.Yellow, 72000, 36000)); TextSource source = new TextSource(items); ParaBox para = new ParaBox(styles, source); root.AddBox(para); theSharpView.Root = root; }