コード例 #1
0
ファイル: MainForm.cs プロジェクト: BackupTheBerlios/dufftv
        public void CreateOnNowListing()
        {
            ProgrammeCollection _tvToday = GetProgrammes();
            ProgrammeCollection _tvNow = _tvToday.GetCurrentShows();

            CustomListBox custListBox = new CustomListBox(prefs.IconSize);
            custListBox.BackColor = Color.White;
            //custListBox.ForeColor = Color.White;

            custListBox.Width = 234;
            custListBox.Height = 230;
            custListBox.Location = new Point(3, 3);

            ImageList _channelImageList = new ImageList();
            _channelImageList.ImageSize = new Size(prefs.IconSize, prefs.IconSize);
            int i = 0;

            //Populate items
            foreach (Programme prog in _tvNow)
            {
                int _currentPos = _tvToday.IndexOf(prog);
                Programme _nextShow = _tvToday[_currentPos + 1];

                ListItem item1 = new ListItem();

                item1.Text = String.Format("{0:HH:mm}", prog.StartTime) + " " + prog.Caption;
                item1.Text += "\r\n" + String.Format("{0:HH:mm}", _nextShow.StartTime) + " " + _nextShow.Caption;
                _channelImageList.Images.Add(prog.ChannelImage);
                item1.ImageIndex = i;
                custListBox.Items.Add(item1);
                i++;
            }

            //Assign ImageList
            custListBox.ImageList = _channelImageList;

            this.Controls.Add(custListBox);
        }
コード例 #2
0
        public void parseObjects()
        {
            _leech = null;

            ProgrammeCollection _tvToday = parsedObj;
            ProgrammeCollection _tvNow = _tvToday.GetCurrentShows();

            // 3 is added to imageheight to get some space between objects
            int itemHeight = 0;
            float fontSize = 0;

            if (_tvNow.Count() > 15)
            {
                itemHeight = 22;
                fontSize = 6F;
            }
            else if (_tvNow.Count() > 10)
            {
                itemHeight = 27;
                fontSize = 8F;
            }
            else if (_tvNow.Count() > 8)
            {
                itemHeight = 35;
                fontSize = 10F;
            }
            else
            {
                itemHeight = 35;
                fontSize = 10F;
            }

            custListBox = new CustomListBox(itemHeight);
            custListBox.WrapText = true;
            custListBox.BackColor = Color.White;
            //custListBox.ForeColor = Color.White;

            int imageSize = itemHeight - 3;

            custListBox.Width = 234;
            custListBox.Height = (itemHeight * _tvNow.Count());
            custListBox.Location = new Point(3, 3);

            ImageList _channelImageList = new ImageList();
            _channelImageList.ImageSize = new Size(imageSize, imageSize);
            int i = 0;

            //Populate items
            foreach (Programme prog in _tvNow)
            {
                int _currentPos = _tvToday.IndexOf(prog);
                Programme _nextShow = _tvToday[_currentPos + 1];

                ListItem item1 = new ListItem();
                item1.FontSize = fontSize;
                //item1.TextStyle = FontStyle.Regular;

                item1.Text = String.Format("{0:HH:mm}", prog.StartTime) + " " + prog.Caption;
                item1.Text += "\r\n" + String.Format("{0:HH:mm}", _nextShow.StartTime) + " " + _nextShow.Caption;
                _channelImageList.Images.Add(prog.ChannelImage);
                item1.ImageIndex = i;
                custListBox.Items.Add(item1);
                i++;
            }

            //Assign ImageList
            custListBox.ImageList = _channelImageList;
        }