public PanelIcon(IconPanel parent, Image image, int index, EventHandler onClickEvent) { this.index=index; this.iconPanel=parent; Image=image; Visible=true; Location=new Point(iconPanel.outlookBar.Size.Width/2-image.Size.Width/2-12, iconPanel.Margin + index*iconPanel.IconSpacing); Size=image.Size; Click+=onClickEvent; Tag=this; MouseEnter+=new EventHandler(OnMouseEnter); MouseLeave+=new EventHandler(OnMouseLeave); MouseMove+=new MouseEventHandler(OnMouseMove); bckgColor=iconPanel.BackColor; mouseEnter=false; }
/** * @desc This method loads in the outlookbar icons, tags and eventhandlers. * This way it also sets up the profiles access rights. * @params [string] userProfile: the name of the currently used user profile * @return [none] No directly returned data. */ private void loadOutlookBarButtons(string userProfile) { switch (userProfile) { // Staff functions case "staff": IconPanel iconPanel1 = new IconPanel("staff"); this.outlookBar.AddBand("Staff Functions", iconPanel1); iconPanel1.AddIcon("Add New Member", global::Gym_administration.Properties.Resources.member_add_128, new EventHandler(PanelEvent)); iconPanel1.AddIcon("Edit Member", global::Gym_administration.Properties.Resources.member_edit_128, new EventHandler(PanelEvent)); iconPanel1.AddIcon("Arrange Class", global::Gym_administration.Properties.Resources.class_book_add_128, new EventHandler(PanelEvent)); iconPanel1.AddIcon("Edit Arranged Class", global::Gym_administration.Properties.Resources.class_book_edit_128, new EventHandler(PanelEvent)); iconPanel1.AddIcon("Edit Equip Bookings", global::Gym_administration.Properties.Resources.equipment_book_edit_128, new EventHandler(PanelEvent)); iconPanel1.AddIcon("Edit Room List", global::Gym_administration.Properties.Resources.room_edit_128, new EventHandler(PanelEvent)); this.outlookBar.SelectBand(0); outlookBar.Show(); break; // Manager functions case "manager": IconPanel iconPanel2 = new IconPanel("manager"); this.outlookBar.AddBand("Management Functions", iconPanel2); iconPanel2.AddIcon("Add New Staff", global::Gym_administration.Properties.Resources.staff_add_128, new EventHandler(PanelEvent)); iconPanel2.AddIcon("Edit Staff", global::Gym_administration.Properties.Resources.staff_edit_128, new EventHandler(PanelEvent)); iconPanel2.AddIcon("Membership Fees", global::Gym_administration.Properties.Resources.payment_search_128, new EventHandler(PanelEvent)); iconPanel2.AddIcon("Edit Arranged Class", global::Gym_administration.Properties.Resources.class_book_edit_128, new EventHandler(PanelEvent)); iconPanel2.AddIcon("Add New Class", global::Gym_administration.Properties.Resources.class_add_128, new EventHandler(PanelEvent)); iconPanel2.AddIcon("Edit Class", global::Gym_administration.Properties.Resources.class_edit_128, new EventHandler(PanelEvent)); iconPanel2.AddIcon("Add New Equipment", global::Gym_administration.Properties.Resources.equipment_add_128, new EventHandler(PanelEvent)); iconPanel2.AddIcon("Edit Equipment", global::Gym_administration.Properties.Resources.equipment_edit_128, new EventHandler(PanelEvent)); iconPanel2.AddIcon("Edit Room List", global::Gym_administration.Properties.Resources.room_edit_128, new EventHandler(PanelEvent)); this.outlookBar.SelectBand(0); outlookBar.Show(); break; // All users functions case "all": IconPanel iconPanel3 = new IconPanel("all"); this.outlookBar.AddBand("Login Options", iconPanel3); iconPanel3.AddIcon("Change Password", global::Gym_administration.Properties.Resources.password_edit_128, new EventHandler(PanelEvent)); this.outlookBar.SelectBand(0); outlookBar.Show(); break; } }