internal void init() { InitializeComponent(); pTop.Height = panelTop; Width = panelWidth; pTop.Dock = DockStyle.Top; pTop.Paint += TablePanel_Paint; pTop.MouseMove += TablePanel_MouseMove; pTop.MouseUp += TablePanel_MouseUp; pTop.MouseDown += TablePanel_MouseDown; pLeft.Width = 1; pLeft.Dock = DockStyle.Left; pRight.Width = 1; pRight.Dock = DockStyle.Right; pBottom.Height = 1; pBottom.Dock = DockStyle.Bottom; //pCenter.Dock = DockStyle.Fill; pRight.BackColor = Color.Black; pLeft.BackColor = Color.Black; pTop.BackColor = Color.Black; pBottom.BackColor = Color.Black; pCenter.BackColor = Color.Black; Controls.Add(pTop); Controls.Add(pBottom); Controls.Add(pLeft); Controls.Add(pRight); Controls.Add(pCenter); int y = 1; foreach (IColumn c in columns.Values) { PanelColumn col = c as PanelColumn; col.Left = 1; col.Width = Width - 2; col.Top = y; col.init(); col.BackColor = Color.White; pCenter.Controls.Add(col); y = col.Top + col.Height; /*Panel p = new Panel(); * p.Width = Width; * p.Height = 2; * p.BackColor = Color.White; * p.Top = y; * pCenter.Controls.Add(p);*/ y = col.Bottom + 2; } Height = y + pTop.Bottom + 2; if (y > MaxHeight) { Height = MaxHeight; pCenter.AutoScroll = true; pCenter.Scroll += pCenter_Scroll; } pCenter.Top = pTop.Height + 1; pCenter.Left = pLeft.Width + 1; pCenter.Width = Width - pLeft.Width - pRight.Width - 2; pCenter.Height = Height - pTop.Height - pBottom.Height - 2; }
private void PanelColumn_MouseUp(object sender, MouseEventArgs e) { int x = Xl + e.X; int y = PosY + e.Y; if (sender is Label) { Label l = sender as Label; x += l.Left; y += l.Top; } PanelDataSet p = Parent.Parent.Parent as PanelDataSet; PanelColumn c = p.Get(x, y); if (c == null) { return; } PanelLink link = new PanelLink(); try { link.Source = this; link.Target = c; p.Links.Add(link); link.Desktop = p; link.Set(); p.Invalidate(); } catch (Exception) { } }
internal PanelColumn Get(int x, int y) { foreach (PanelTable t in Tables.Values) { PanelColumn p = t.Get(x, y); if (p != null) { return(p); } } return(null); }