public virtual List <Button> CreateButtonList(AbstractSizeChangeContext sizeContext) { List <Button> btnList = new List <Button>(); SlaveInfoService.LatticeInfoList.ForEach(latticeInfo => { var btn = CreateButton(latticeInfo, sizeContext); btnList.Add(btn); }); return(btnList); }
public void ReSizeButons(AbstractSizeChangeContext sizeContext) { var btnList = CreateButtonList(sizeContext); if (btnList != null) { BtnList.ForEach(btn => { var bpc = btnList.Find(o => o.Name == btn.Name); btn.Location = bpc.Location; btn.Size = bpc.Size; btn.Font = bpc.Font; }); } }
private Button CreateButton(LatticeInfo latticeInfo, AbstractSizeChangeContext sizeContext) { var btn = new Button() { Name = latticeInfo.LatticeNo, Text = latticeInfo.DisPlay(), TextAlign = ContentAlignment.MiddleLeft, Location = new Point(sizeContext.X, sizeContext.Y), Size = new Size(sizeContext.BtnWidth, sizeContext.BtnHeight), BackColor = latticeInfo.BackColor(), Font = new Font("宋体", sizeContext.EmSize, FontStyle.Bold, GraphicsUnit.Point, 134) }; sizeContext.UpdateButtonLocation(); return(btn); }