// Change body view to Faculty section when "By Faculty Area" is clicked private void faculty_research_tab_Enter(object sender, EventArgs e) { research_tabs.SelectedTab = faculty_research_tab; // Ensure data hasn't already been loaded if (faculty_research_panel.HasChildren) { return; } // Dynamically load research by faculty int row = 0; int column = 0; for (int i = 0; i < research.byFaculty.Count; i++) { ByFaculty fac = research.byFaculty[i]; Label facName = new Label(); facName.Text = fac.facultyName; facName.MouseEnter += (sender2, e2) => changeCellColor(sender2, e2); facName.MouseLeave += (sender3, e3) => changeCellColor(sender3, e3); facName.Margin = new Padding(0, 0, facName.Margin.Right, facName.Margin.Right); facName.BorderStyle = BorderStyle.FixedSingle; facName.TextAlign = ContentAlignment.MiddleCenter; facName.Anchor = (AnchorStyles.Left | AnchorStyles.Right); faculty_research_panel.Controls.Add(facName, column, row); // Set onclick event handler to show degree details in popup facName.Click += (sender4, e4) => showResearchFacPopup(sender4, e4, fac); // Jump to next row if current row is full if ((i + 1) % 3 == 0) { row++; column = 0; } else { column++; } } // Resize rows foreach (RowStyle style in faculty_research_panel.RowStyles) { style.SizeType = SizeType.AutoSize; } }
// Popup for Research by Faculty private void showResearchFacPopup(object sender4, EventArgs e4, ByFaculty facName) { Popup popup = new Popup(facName); popup.Show(); }
public Popup(ByFaculty fac) { InitializeComponent(); researchByFaculty = fac; }