コード例 #1
0
        DataItemSelected(ListView lvCur)
        {
            Debug.Assert((lvCur.SelectedItems.Count > 1) == false);

            if (lvCur.SelectedItems.Count != 0)
            {
                Snoop.Data.Data tmpSnoopData = (Snoop.Data.Data)lvCur.SelectedItems[0].Tag;
                tmpSnoopData.DrillDown();
            }
        }
コード例 #2
0
        Display(ListView lvCur, Snoop.Collectors.Collector snoopCollector)
        {
            lvCur.BeginUpdate();
            lvCur.Items.Clear();

            Font      oldFont  = lvCur.Font;
            FontStyle newStyle = lvCur.Font.Style ^ FontStyle.Bold;
            Font      boldFont = new Font(oldFont, newStyle);

            for (int i = 0; i < snoopCollector.Data().Count; i++)
            {
                Snoop.Data.Data tmpSnoopData = (Snoop.Data.Data)snoopCollector.Data()[i];

                // if it is a class separator, then color the background differently
                // and don't add a SubItem for the "Field" value
                if (tmpSnoopData.IsSeparator)
                {
                    ListViewItem lvItem = new ListViewItem(tmpSnoopData.StrValue());

                    if (tmpSnoopData is Snoop.Data.ClassSeparator)
                    {
                        lvItem.BackColor = System.Drawing.Color.LightBlue;
                    }
                    else
                    {
                        lvItem.BackColor = System.Drawing.Color.WhiteSmoke;
                    }

                    lvItem.Tag = tmpSnoopData;
                    lvCur.Items.Add(lvItem);
                }
                else
                {
                    ListViewItem lvItem = new ListViewItem(tmpSnoopData.Label);
                    lvItem.SubItems.Add(tmpSnoopData.StrValue());

                    if (tmpSnoopData.IsError)
                    {
                        ListViewItem.ListViewSubItem sItem = (ListViewItem.ListViewSubItem)lvItem.SubItems[0];
                        sItem.ForeColor = System.Drawing.Color.Red;
                    }

                    if (tmpSnoopData.HasDrillDown)
                    {
                        ListViewItem.ListViewSubItem sItem = (ListViewItem.ListViewSubItem)lvItem.SubItems[0];
                        sItem.Font = boldFont;
                    }

                    lvItem.Tag = tmpSnoopData;
                    lvCur.Items.Add(lvItem);
                }
            }

            lvCur.EndUpdate();
        }