コード例 #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Region clippingRegion = e.Graphics.Clip;

            using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
            {
                foreach (var cell in _channelCells)
                {
                    Rectangle visibleRectangle = new Rectangle(cell.Rectangle.Location, cell.Rectangle.Size);
                    visibleRectangle.Intersect(e.ClipRectangle);

                    Region cellRegion = new Region(visibleRectangle);
                    cellRegion.Intersect(clippingRegion);
                    if (cellRegion.IsEmpty(e.Graphics))
                    {
                        continue;
                    }

                    e.Graphics.SetClip(visibleRectangle);

                    Padding innerPadding = new Padding(2, 2, 2, 2);

                    if (cell.Channel != null)
                    {
                        Rectangle innerRectangle = new Rectangle(cell.Rectangle.Left + innerPadding.Left, cell.Rectangle.Top + innerPadding.Top,
                                                                 cell.Rectangle.Width - innerPadding.Horizontal, cell.Rectangle.Height - innerPadding.Vertical);

                        Image logoImage = null;
                        try
                        {
                            logoImage = ChannelLogosCache.GetLogoImage(tvSchedulerAgent, cell.Channel, (int)(64 * _widthFactor), (int)(64 * _heightFactor));
                        }
                        catch
                        {
                            logoImage = null;
                        }

                        if (logoImage == null)
                        {
                            e.Graphics.DrawString(cell.Channel.DisplayName, _channelFont, _channelBrush,
                                                  new RectangleF(innerRectangle.Left, innerRectangle.Top + 6, innerRectangle.Width, innerRectangle.Height));
                        }
                        else
                        {
                            e.Graphics.DrawImage(logoImage, innerRectangle.Left + (int)Math.Round((innerRectangle.Width - logoImage.Width) / 2F),
                                                 innerRectangle.Top + (int)Math.Round((innerRectangle.Height - logoImage.Height) / 2F),
                                                 logoImage.Width, logoImage.Height);
                        }
                    }
                }
            }
            base.OnPaint(e);
        }
コード例 #2
0
 public static string GetLogoImage(Guid channelId, string channelDisplayName, ISchedulerService tvSchedulerAgent)
 {
     return(ChannelLogosCache.GetLogoPath(tvSchedulerAgent, channelId, channelDisplayName, HomeBase.LogoIconWidth, HomeBase.LogoIconHeight));
 }
コード例 #3
0
ファイル: Utility.cs プロジェクト: rob-opsi/ARGUS-TV
 public static string GetLogoImage(Guid channelId, string channelDisplayName)
 {
     return(ChannelLogosCache.GetLogoPath(channelId, channelDisplayName, HomeBase.LogoIconWidth, HomeBase.LogoIconHeight));
 }