Exemplo n.º 1
0
        private static void RenewScreen(XDocument doc, int CurrentScreen)
        {
            Widgets          WW   = new Widgets(doc, CurrentScreen);
            ScreenTable      ST   = new ScreenTable(doc);
            ButtonsPole      BP   = new ButtonsPole(doc);
            TableLayoutPanel tp   = LoadTPFromFile(ST);
            TableLayoutPanel Pole = LoadPole(doc, BP);

            ff.LoadWidgets(WW, tp, Pole, CurrentScreen);
            ff.Controls.Add(tp);
        }
Exemplo n.º 2
0
        private static TableLayoutPanel LoadPole(XDocument doc, ButtonsPole bP)
        {
            var a = doc.Descendants("ButtonsPole").First();
            int r = Convert.ToInt32(a.Attribute("Rows")?.Value ?? "1");
            int c = Convert.ToInt32(a.Attribute("Cols")?.Value ?? "1");
            TableLayoutPanel P = new TableLayoutPanel
            {
#if DEBUG
                CellBorderStyle = TableLayoutPanelCellBorderStyle.Single,
#endif
                Dock        = DockStyle.Fill,
                RowCount    = (int)Math.Ceiling(((decimal)bP.B.Count()) / c),
                ColumnCount = c
            };

            foreach (var b in bP.B)
            {
                //Button BB = new Button
                RoundButton BB = new RoundButton
                {
                    Dock      = DockStyle.Fill,
                    Text      = b.Text,
                    Tag       = b.Id,
                    Font      = b.F,
                    ForeColor = b.FC,
                    BackColor = b.BC //,
                                     //Image = b.I
                };

                BB.Click += ff.BB_Click;

                P.Controls.Add(BB);
            }
            P.RowStyles.Clear();
            P.ColumnStyles.Clear();
            for (int i = 0; i < (int)Math.Ceiling((decimal)bP.B.Count() / c); i++)
            {
                P.RowStyles.Add(new RowStyle(SizeType.Percent, 100 / r));
            }

            for (int i = 0; i < c; i++)
            {
                P.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100 / c));
            }

            return(P);
        }