Example #1
0
		private void panel1_MouseMove(object sender,MouseEventArgs e) {
			//there is 1 region per bucket (synced in paint event), loop through the regions and see if we are hovering over one of them
			for(int i=0;i<ListRegions.Count;i++) {
				if(!ListRegions[i].IsVisible(new Point(e.X,e.Y))) {//we are hovering over this bucket
					continue;
				}
				if(i==CurrentHoverRegionIdx) {//only activate this bucket once (prevents flicker)
					return;
				}
				//build the display string for this hover bucket
				List<Employee> listEmps=null;
				TimeSpan tsStart=new TimeSpan(5,(i*15),0);
				toolTip.ToolTipTitle=tsStart.ToShortTimeString()+" - "+tsStart.Add(TimeSpan.FromMinutes(15)).ToShortTimeString();
				string employees="";
				if(DictEmployeesPerBucket.TryGetValue(i,out listEmps)) {
					toolTip.ToolTipTitle=toolTip.ToolTipTitle+" ("+listEmps.Count.ToString()+" Techs)";
					listEmps.Sort(new Employees.EmployeeComparer(Employees.EmployeeComparer.SortBy.firstName));
					for(int p=0;p<listEmps.Count;p++) {
						List<Schedule> sch=Schedules.GetForEmployee(ListScheds,listEmps[p].EmployeeNum);
						employees+=listEmps[p].FName;
						employees+=Schedules.GetCommaDelimStringForScheds(sch);
						employees+="\r\n";
					}
				}
				//activate and show this bucket's tooltip
				toolTip.Active=true;
				toolTip.SetToolTip(this,employees);
				//save this region as current so we only activate it once
				CurrentHoverRegionIdx=i;
				return;
			}
			//not hovering over a bucket so kill the tooltip
			toolTip.Active=false;
			CurrentHoverRegionIdx=-1;
		}