SIL.FieldWorks.SharpViews.AssembledStyles.WithBackColor C# (CSharp) Method

WithBackColor() public method

public WithBackColor ( Color backColor ) : AssembledStyles
backColor Color
return AssembledStyles
		public AssembledStyles WithBackColor(Color backColor)
		{
			return m_styleCache.GetDerivedStyle(this, (int)FwTextPropType.ktptBackColor, ColorUtil.ConvertColorToBGR(backColor),
												(newStyles, w) => newStyles.m_chrp.clrBack = ColorUtil.ConvertColorToBGR(backColor));
		}

Usage Example

Example #1
0
		private void InitSeveralBoxes()
		{
			var styles = new AssembledStyles();
			RootBox root = new RootBoxFdo(styles);
			var items = new List<IClientRun>();
			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 ImageBox(styles.WithBackColor(Color.Pink).WithBorderColor(Color.Blue)
				.WithBorders(new Thickness(2.0)).WithPads(new Thickness(4.0)), new Icon(SystemIcons.Shield, 40, 40).ToBitmap()));
			items.Add(new BlockBox(styles, Color.Yellow, 72000, 36000));
			var source = new TextSource(items);
			var para = new ParaBox(styles, source);
			root.AddBox(para);
			theSharpView.Root = root;
		}