Example #1
0
        public FormJoin(List<string> sqlTable, string connectionString)
            : this()
        {
            this.sqlTable = sqlTable;
            int oldX = 0;
            int oldY = 0;
            foreach (var table in sqlTable)
            {
                var tableEntity = new Table();
                tableEntity.Name = table;
                tableEntity.setTitle(table);
                DBService service = new DBService(connectionString);
                List<QColumn> columns = service.GetColumns(table);
                tableEntity.setSource(columns);

                Point p = new Point();
                p.X = panel1.Location.X + oldX;
                p.Y = panel1.Location.Y + oldY;

                tableEntity.Location = p;
                oldX += tableEntity.Width + 5;

                if (oldX > panel1.Width)
                {
                    oldX = 0;
                    oldY += tableEntity.Height + 5;
                }
                tableEntity.MouseDown += new MouseEventHandler(Control_MouseDown);
                tableEntity.MouseMove += new MouseEventHandler(Control_MouseMove);
                tableEntity.MouseUp += new MouseEventHandler(Control_MouseUp);

                panel1.Controls.Add(tableEntity);
            }
            panel1.Invalidate();
        }