GetColor() public method

public GetColor ( int n ) : Color
n int
return Color
Beispiel #1
0
        public void Refresh(GroupDefineItemCollection groups)
        {
            myButtonGroup.DelAllButtons();  //清除当前按钮

            buttonFont = new Font(toolStrip.Font.FontFamily, 12, toolStrip.Font.Style);

            for (int i = 1; i <= groups.UserGroupCount; i++)
            {
                ToolStripButton button = new ToolStripButton();

                string title     = groups.GetViewName(i);
                string fullTitle = groups.GetFullViewName(i);
                Color  color     = groups.GetColor(i);

                button.Font        = buttonFont;
                button.ForeColor   = color;
                button.Text        = title;
                button.ToolTipText = fullTitle;
                myButtonGroup.AddButton(button);
            }

            if (myButtonGroup[0] != null)
            {
                myButtonGroup[0].Checked = true;
            }
        }
        public void Refresh(GroupDefineItemCollection groups)
        {
            myButtonGroup.DelAllButtons();  //清除当前按钮

            buttonFont = new Font(toolStrip.Font.FontFamily, 12, toolStrip.Font.Style);

            for (int i = 1; i <= groups.UserGroupCount; i++)
            {
                ToolStripButton button = new ToolStripButton();

                string title = groups.GetViewName(i);
                string fullTitle = groups.GetFullViewName(i);
                Color color = groups.GetColor(i);

                button.Font = buttonFont;
                button.ForeColor = color;
                button.Text = title;
                button.ToolTipText = fullTitle;
                myButtonGroup.AddButton(button);
            }

            if(myButtonGroup[0] != null)
                myButtonGroup[0].Checked = true;
        }
Beispiel #3
0
        public bool ReloadItems(List <LabelItem> items)
        {
            try
            {
                //record selected item
                int index;
                if (lv.SelectedIndices.Count != 0)
                {
                    index = lv.SelectedIndices[0];
                }
                else
                {
                    index = -1;
                }

                if (items == null)
                {
                    lv.Items.Clear();
                    return(true);
                }

                int number = 1;
                foreach (LabelItem n in items)
                {
                    if (lv.Items.Count >= number)
                    {
                        //edit the category
                        lv.Items[number - 1].SubItems[2].Text = getCategoryName(n.Category);

                        lv.Items[number - 1].SubItems[2].ForeColor =
                            group.GetColor(n.Category);

                        //edit the Text
                        lv.Items[number - 1].SubItems[1].Text = n.Text;
                        //lv.Items[number - 1].SubItems[1].ForeColor = GlobalVar.CategoryColor[n.Category];
                    }
                    else
                    {
                        //Add item
                        lv.Items.Add(number.ToString());
                        lv.Items[number - 1].UseItemStyleForSubItems = false;
                        lv.Items[number - 1].SubItems.Add(n.Text);
                        lv.Items[number - 1].SubItems.Add(getCategoryName(n.Category),
                                                          group.GetColor(n.Category),
                                                          lv.BackColor,
                                                          lv.Font);
                    }
                    number++;
                }

                //delete
                number -= 1;
                if (lv.Items.Count > number)
                {
                    for (int i = lv.Items.Count - 1; i > number - 1; i--)
                    {
                        lv.Items.RemoveAt(i);
                    }
                }

                //select
                if (index != -1 && lv.Items.Count >= index + 1)
                {
                    lvSelectedIndexChangedEnable = false;
                    lv.Items[index].Selected     = true;
                    lvSelectedIndexChangedEnable = true;
                }

                //OnListViewSelectedIndexChanged();
                return(true);
            }
            catch
            {
                lvSelectedIndexChangedEnable = true;
                //OnListViewSelectedIndexChanged();
                return(false);
            }
        }