Пример #1
0
        private void PanelDoubleClick(object sender, EventArgs eventArgs)
        {
            Control control  = (Control)sender;
            int     senderId = int.Parse(control.Name);

            MainWindowPanel.Controls.Clear();

            var table = GenericGetData <Sheet> .GetDataFromDB(x => x.UzsakymoID == senderId);

            Panel last = null;

            foreach (var item in table)
            {
                Panel panel = new Panel();
                panel.Size        = new Size(500, 250);
                panel.BorderStyle = BorderStyle.FixedSingle;
                panel.BackColor   = Color.White;
                panel.Location    = CalculatePanelPosition(last);

                panel.Name = item.Id.ToString();

                last = panel;
                MainWindowPanel.Controls.Add(panel);
            }
        }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var table = GenericGetData <Uzsakymai> .GetDataFromDB(x => x.State != "Done");

            Panel last = null;

            foreach (var item in table)
            {
                Panel panel = new Panel();
                panel.Size         = new Size(500, 250);
                panel.BorderStyle  = BorderStyle.FixedSingle;
                panel.BackColor    = Color.White;
                panel.Location     = CalculatePanelPosition(last);
                panel.DoubleClick += PanelDoubleClick;
                panel.Name         = item.Id.ToString();
                CreateLabel(item.OrderNumber, panel);
                foreach (Control contr in panel.Controls)
                {
                    contr.DoubleClick += PanelDoubleClick;
                    contr.Name         = item.Id.ToString();
                }
                last = panel;
                MainWindowPanel.Controls.Add(panel);
            }
        }