Exemple #1
0
 private void _programsDataGridView_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
 {
     foreach (DataGridViewRow row in _programsDataGridView.Rows)
     {
         Icon   icon    = Properties.Resources.TransparentIcon;
         string toolTip = null;
         UpcomingOrActiveProgramView programView = row.DataBoundItem as UpcomingOrActiveProgramView;
         if (programView != null)
         {
             ProgramIconUtility.GetIconAndToolTip(_scheduleType, programView.CancellationReason, programView.IsPartOfSeries,
                                                  this.UnfilteredUpcomingRecordings ?? this.UpcomingPrograms, programView.UpcomingRecording, out icon, out toolTip);
             if (programView.UpcomingRecording != null &&
                 programView.CancellationReason == UpcomingCancellationReason.None)
             {
                 row.Cells[2].ToolTipText = ProcessUtility.BuildRecordingInfoToolTip(programView.UpcomingRecording, "on");
             }
             else if (programView.ActiveRecording != null &&
                      programView.CancellationReason == UpcomingCancellationReason.None)
             {
                 row.Cells[2].ToolTipText = ProcessUtility.BuildRecordingInfoToolTip(programView.ActiveRecording, "on");
             }
             else
             {
                 row.Cells[2].ToolTipText = null;
             }
         }
         row.Cells[0].Value       = icon;
         row.Cells[0].ToolTipText = toolTip;
     }
 }
Exemple #2
0
        private bool DrawScheduleIcon(GuideProgramCell cell, PaintEventArgs e, float titleTop, ref int titleLeft, SerializableDictionary <Guid, GuideUpcomingProgram> upcomingById)
        {
            GuideUpcomingProgram upcomingProgramInfo;

            if (upcomingById.TryGetValue(cell.GetUniqueUpcomingProgramId(), out upcomingProgramInfo))
            {
                Icon   icon;
                string toolTip = null;
                if (upcomingProgramInfo.UpcomingRecording != null)
                {
                    toolTip = ProcessUtility.BuildRecordingInfoToolTip(upcomingProgramInfo.UpcomingRecording, "on");
                }
                string toolTip2;
                ProgramIconUtility.GetIconAndToolTip(upcomingProgramInfo.Type, upcomingProgramInfo.CancellationReason,
                                                     upcomingProgramInfo.IsPartOfSeries, _model.UpcomingRecordings, upcomingProgramInfo.UpcomingRecording,
                                                     out icon, out toolTip2);
                if (!String.IsNullOrEmpty(toolTip2))
                {
                    if (!String.IsNullOrEmpty(toolTip))
                    {
                        toolTip = toolTip + Environment.NewLine + Environment.NewLine + toolTip2;
                    }
                    else
                    {
                        toolTip = toolTip2;
                    }
                }
                Rectangle iconRectangle = new Rectangle(titleLeft, (int)Math.Round(titleTop), icon.Width, icon.Height);
                if (!String.IsNullOrEmpty(toolTip))
                {
                    cell.ToolTips.Add(new CellToolTip(iconRectangle, toolTip));
                }

                int height = (int)(icon.Height * _heightFactor);
                e.Graphics.DrawIcon(icon, iconRectangle.X, iconRectangle.Y + (int)Math.Floor((height - icon.Height) / 2.0));
                titleLeft += icon.Width;
                return(true);
            }
            return(false);
        }