//Ok, you've seen everything of importance at this point; I am begging you to spare yourself. You must not read any further!

        public void AddItem(string text, params string[] subItems)
        {
            List <NSListViewSubItem> Items = new List <NSListViewSubItem>();

            foreach (string I in subItems)
            {
                NSListViewSubItem SubItem = new NSListViewSubItem();
                SubItem.Text = I;
                Items.Add(SubItem);
            }

            NSListViewItem Item = new NSListViewItem();

            Item.Text     = text;
            Item.SubItems = Items;

            _Items.Add(Item);
            InvalidateScroll();
        }
Exemplo n.º 2
0
    public void RemoveItems(NSListViewItem[] items)
    {
        foreach (NSListViewItem I in items)
        {
            _Items.Remove(I);
        }

        InvalidateScroll();
    }
Exemplo n.º 3
0
 public void RemoveItem(NSListViewItem item)
 {
     _Items.Remove(item);
     InvalidateScroll();
 }
Exemplo n.º 4
0
    //Ok, you've seen everything of importance at this point; I am begging you to spare yourself. You must not read any further!

    public void AddItem(string text, params string[] subItems)
    {
        List<NSListViewSubItem> Items = new List<NSListViewSubItem>();
        foreach (string I in subItems)
        {
            NSListViewSubItem SubItem = new NSListViewSubItem();
            SubItem.Text = I;
            Items.Add(SubItem);
        }

        NSListViewItem Item = new NSListViewItem();
        Item.Text = text;
        Item.SubItems = Items;

        _Items.Add(Item);
        InvalidateScroll();
    }
        //I am so sorry you have to witness this. I tried warning you. ;.;

        protected override void OnPaint(PaintEventArgs e)
        {
            ThemeModule theme = new ThemeModule();
            var         G     = theme.G;


            G = e.Graphics;
            G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;

            G.Clear(BackColor);

            int   X = 0;
            int   Y = 0;
            float H = 0;

            G.DrawRectangle(P1, 1, 1, Width - 3, Height - 3);

            Rectangle      R1 = default(Rectangle);
            NSListViewItem CI = null;

            int Offset = Convert.ToInt32(VS.Percent * (VS.Maximum - (Height - (ItemHeight * 2))));

            int StartIndex = 0;

            if (Offset == 0)
            {
                StartIndex = 0;
            }
            else
            {
                StartIndex = (Offset / ItemHeight);
            }

            int EndIndex = Math.Min(StartIndex + (Height / ItemHeight), _Items.Count - 1);

            for (int I = StartIndex; I <= EndIndex; I++)
            {
                CI = Items[I];

                R1 = new Rectangle(0, ItemHeight + (I * ItemHeight) + 1 - Offset, Width, ItemHeight - 1);

                H = G.MeasureString(CI.Text, Font).Height;
                Y = R1.Y + Convert.ToInt32((ItemHeight / 2) - (H / 2));

                if (_SelectedItems.Contains(CI))
                {
                    if (I % 2 == 0)
                    {
                        G.FillRectangle(B1, R1);
                    }
                    else
                    {
                        G.FillRectangle(B2, R1);
                    }
                }
                else
                {
                    if (I % 2 == 0)
                    {
                        G.FillRectangle(B3, R1);
                    }
                    else
                    {
                        G.FillRectangle(B4, R1);
                    }
                }

                G.DrawLine(P2, 0, R1.Bottom, Width, R1.Bottom);

                if (Columns.Length > 0)
                {
                    R1.Width = Columns[0].Width;
                    G.SetClip(R1);
                }

                //TODO: Ellipse text that overhangs seperators.
                G.DrawString(CI.Text, Font, Brushes.Black, 10, Y + 1);
                G.DrawString(CI.Text, Font, Brushes.WhiteSmoke, 9, Y);

                if (CI.SubItems != null)
                {
                    for (int I2 = 0; I2 <= Math.Min(CI.SubItems.Count, _Columns.Count) - 1; I2++)
                    {
                        X = ColumnOffsets[I2 + 1] + 4;

                        R1.X     = X;
                        R1.Width = Columns[I2].Width;
                        G.SetClip(R1);

                        G.DrawString(CI.SubItems[I2].Text, Font, Brushes.Black, X + 1, Y + 1);
                        G.DrawString(CI.SubItems[I2].Text, Font, Brushes.WhiteSmoke, X, Y);
                    }
                }

                G.ResetClip();
            }

            R1 = new Rectangle(0, 0, Width, ItemHeight);

            GB1 = new LinearGradientBrush(R1, Color.FromArgb(60, 60, 60), Color.FromArgb(55, 55, 55), 90f);
            G.FillRectangle(GB1, R1);
            G.DrawRectangle(P3, 1, 1, Width - 22, ItemHeight - 2);

            int LH = Math.Min(VS.Maximum + ItemHeight - Offset, Height);

            NSListViewColumnHeader CC = null;

            for (int I = 0; I <= _Columns.Count - 1; I++)
            {
                CC = Columns[I];

                H = G.MeasureString(CC.Text, Font).Height;
                Y = Convert.ToInt32((ItemHeight / 2) - (H / 2));
                X = ColumnOffsets[I];
                G.DrawString(CC.Text, Font, Brushes.Black, X + 1, Y + 1);
                G.DrawString(CC.Text, Font, Brushes.WhiteSmoke, X, Y);

                G.DrawLine(P2, X - 3, 0, X - 3, LH);
                G.DrawLine(P3, X - 2, 0, X - 2, ItemHeight);
            }

            G.DrawRectangle(P2, 0, 0, Width - 1, Height - 1);

            G.DrawLine(P2, 0, ItemHeight, Width, ItemHeight);
            G.DrawLine(P2, VS.Location.X - 1, 0, VS.Location.X - 1, Height);
        }
 public void RemoveItem(NSListViewItem item)
 {
     _Items.Remove(item);
     InvalidateScroll();
 }
        //I am so sorry you have to witness this. I tried warning you. ;.;

        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics G = e.Graphics;

            G = e.Graphics;

            G.Clear(Color.White);

            int   X = 0;
            int   Y = 0;
            float H = 0;

            G.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(50, Color.LightGray))), 1, 1, Width - 3, Height - 3);

            Rectangle      R1 = default(Rectangle);
            NSListViewItem CI = null;

            int Offset = Convert.ToInt32(VS.Percent * (VS.Maximum - (Height - (ItemHeight * 2))));

            int StartIndex = 0;

            if (Offset == 0)
            {
                StartIndex = 0;
            }
            else
            {
                StartIndex = (Offset / ItemHeight);
            }

            int EndIndex = Math.Min(StartIndex + (Height / ItemHeight), _Items.Count - 1);

            for (int I = StartIndex; I <= EndIndex; I++)
            {
                CI = Items[I];

                R1 = new Rectangle(0, ItemHeight + (I * ItemHeight) + 1 - Offset, Width, ItemHeight - 1);

                H = G.MeasureString(CI.Text, Font).Height;
                Y = R1.Y + Convert.ToInt32((ItemHeight / 2) - (H / 2));

                if (_SelectedItems.Contains(CI))
                {
                    if (I % 2 == 0)
                    {
                        G.FillRectangle(new SolidBrush(Color.FromArgb(40, Color.LightGray)), R1);
                    }
                    else
                    {
                        G.FillRectangle(new SolidBrush(Color.FromArgb(40, Color.LightGray)), R1);
                    }
                }
                else
                {
                    if (I % 2 == 0)
                    {
                        G.FillRectangle(Brushes.White, R1);
                    }
                    else
                    {
                        G.FillRectangle(Brushes.White, R1);
                    }
                }

                G.DrawLine(Pens.LightGray, 0, R1.Bottom, Width, R1.Bottom);

                if (Columns.Length > 0)
                {
                    R1.Width = Columns[0].Width;
                    G.SetClip(R1);
                }

                //TODO: Ellipse text that overhangs seperators.
                G.DrawString(CI.Text, Font, new SolidBrush(Color.FromArgb(1, 75, 124)), 10, Y + 1);


                if (CI.SubItems != null)
                {
                    for (int I2 = 0; I2 <= Math.Min(CI.SubItems.Count, _Columns.Count) - 1; I2++)
                    {
                        X = ColumnOffsets[I2 + 1] + 4;

                        R1.X     = X;
                        R1.Width = Columns[I2].Width;
                        G.SetClip(R1);

                        G.DrawString(CI.SubItems[I2].Text, Font, new SolidBrush(Color.FromArgb(1, 75, 124)), X + 1, Y + 1);
                    }
                }

                G.ResetClip();
            }

            R1 = new Rectangle(0, 0, Width, ItemHeight);

            GB1 = new LinearGradientBrush(R1, Color.FromArgb(255, 255, 255), Color.FromArgb(245, 245, 245), 90f);
            G.FillRectangle(GB1, R1);
            G.SetClip(R1);
            G.FillRectangle(Brushes.White, new Rectangle(0, 0, R1.Width - 1, R1.Height / 2 - 1));
            G.ResetClip();
            G.DrawRectangle(Pens.White, 1, 1, Width - 22, ItemHeight - 2);

            int LH = Math.Min(VS.Maximum + ItemHeight - Offset, Height);

            NSListViewColumnHeader CC = null;

            for (int I = 0; I <= _Columns.Count - 1; I++)
            {
                CC = Columns[I];

                H = G.MeasureString(CC.Text, Font).Height;
                Y = Convert.ToInt32((ItemHeight / 2) - (H / 2));
                X = ColumnOffsets[I];

                G.DrawString(CC.Text, Font, new SolidBrush(Color.FromArgb(1, 75, 124)), X + 1, Y + 1);


                G.DrawLine(Pens.LightGray, X - 3, 0, X - 3, LH);
                G.DrawLine(Pens.White, X - 2, 0, X - 2, ItemHeight);
            }

            G.DrawRectangle(Pens.LightGray, 0, 0, Width - 1, Height - 1);

            G.DrawLine(new Pen(new SolidBrush(Color.LightGray)), 0, ItemHeight, Width, ItemHeight);
            G.DrawLine(new Pen(Brushes.LightGray), VS.Location.X - 1, 0, VS.Location.X - 1, Height);

            G.FillRectangle(Brushes.White, Width - 19, 0, Width, Height);
        }