コード例 #1
0
        private void ListConditions(RuleConditions masterlist, RuleConditions list)
        {
            listConditions.Items.Clear();
            foreach (RuleCondition rc in masterlist)
            {
                LinkLabel ll = new LinkLabel();
                ll.Text     = rc.Text;
                ll.LinkArea = new LinkArea(rc.ValueStart, rc.ValueText.Length);
                RuleViewItem rvi = new RuleViewItem(ll);
                rvi.Tag = rc;

                if (list.FindByFormat(rc.TextFormat) != null)
                {
                    rvi.Checked = true;
                }

                listConditions.Items.Add(rvi);
            }
        }
コード例 #2
0
        static void listView_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            ListView listView = (ListView)sender;

            if (e.Item is RuleViewItem)
            {
                RuleViewItem rvi     = (RuleViewItem)e.Item;
                Brush        bgBrush = rvi.Selected ? SystemBrushes.Highlight : SystemBrushes.HighlightText;
                e.Graphics.FillRectangle(bgBrush, e.Bounds);

                Color backColor = rvi.Selected ? SystemColors.Highlight : SystemColors.HighlightText;
                Color linkColor = rvi.Selected ? SystemColors.HighlightText : SystemColors.Highlight;
                Color foreColor = rvi.Selected ? SystemColors.HighlightText : SystemColors.WindowText;
                //rvi.Label.BackColor = Color.Yellow;

                //rvi.label.PaintLabel(e.Graphics, foreColor, backColor, linkColor, new Rectangle(e.Bounds.X + 23, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));

                PaintLinkLabel(e.Graphics, rvi.label.Text, rvi.label.LinkArea, rvi.label.Font, foreColor, backColor, linkColor, new Rectangle(e.Bounds.X + 23, e.Bounds.Y, e.Bounds.Width - 23, e.Bounds.Height));

                if (rvi.Checked)
                {
                    ControlPaint.DrawCheckBox(e.Graphics, 5, e.Bounds.Top + 1, 15, 15, ButtonState.Flat | ButtonState.Checked);
                }
                else
                {
                    ControlPaint.DrawCheckBox(e.Graphics, 5, e.Bounds.Top + 1, 15, 15, ButtonState.Flat);
                }

                if (rvi.Focused && listView.Focused)
                {
                    ControlPaint.DrawFocusRectangle(e.Graphics, e.Bounds);
                }
            }
            else
            {
                e.DrawDefault = true;
            }
        }
コード例 #3
0
 private void Form1_Load(object sender, EventArgs e)
 {
     RuleViewItem.Prepare(listConditions);
 }