void v_MouseEnter(object sender, EventArgs e) { Viewer v = (Viewer)sender; TempPanel p = (TempPanel)v.Parent; p.Hover = true; }
void v_MouseLeave(object sender, EventArgs e) { Viewer v = (Viewer)sender; TempPanel p = (TempPanel)v.Parent; p.Hover = false; }
void v_MouseClick(object sender, MouseEventArgs e) { UnselectAll(); Viewer v = (Viewer)sender; TempPanel p = (TempPanel)v.Parent; p.Selected = true; _selected = v; }
private void Setup() { int columns = paneCount / 2; int rows = 2; this.tableLayoutPanel.RowCount = rows; this.tableLayoutPanel.ColumnCount = columns; this.tableLayoutPanel.RowStyles.Clear(); this.tableLayoutPanel.ColumnStyles.Clear(); for (int j = 0; j < columns; j++) { this.tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50)); } for (int i = 0; i < rows; i++) { this.tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50)); } for (int j = 0; j < columns; j++) { for (int i = 0; i < rows; i++) { TempPanel p = new TempPanel(); Viewer v = new Viewer(); v.Dock = DockStyle.Fill; p.Controls.Add(v); p.Padding = new Padding(5); v.MouseClick += new MouseEventHandler(v_MouseClick); v.MouseEnter += new EventHandler(v_MouseEnter); v.MouseLeave += new EventHandler(v_MouseLeave); p.Dock = DockStyle.Fill; this.tableLayoutPanel.Controls.Add(p, j, i); } } }
private void Setup() { int columns = paneCount / 2; int rows = 2; this.tableLayoutPanel.RowCount = rows; this.tableLayoutPanel.ColumnCount = columns; this.tableLayoutPanel.RowStyles.Clear(); this.tableLayoutPanel.ColumnStyles.Clear(); for (int j = 0; j < columns; j++) { this.tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent,50)); } for (int i = 0; i < rows; i++) { this.tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent,50)); } for (int j = 0; j < columns; j++) { for (int i = 0; i < rows; i++) { TempPanel p = new TempPanel(); Viewer v = new Viewer(); v.Dock = DockStyle.Fill; p.Controls.Add(v); p.Padding = new Padding(5); v.MouseClick += new MouseEventHandler(v_MouseClick); v.MouseEnter +=new EventHandler(v_MouseEnter); v.MouseLeave += new EventHandler(v_MouseLeave); p.Dock = DockStyle.Fill; this.tableLayoutPanel.Controls.Add(p,j, i); } } }