Example #1
0
        public ListViewAdpter(ListView listview, GroupDefineItemCollection groupDefine)
        {
            lv = listview;

            lv.Columns.Clear();
            lv.Columns.Add("No.");
            lv.Columns.Add("Text");
            lv.Columns.Add("Category");
            lv.FullRowSelect = true;
            lv.GridLines     = true;
            lv.HideSelection = false;

            lv.MultiSelect = true;
            lv.Scrollable  = true;
            lv.HeaderStyle = ColumnHeaderStyle.None;

            lv.ClientSizeChanged    += new EventHandler(lvClientSizeChanged);
            lv.SelectedIndexChanged += new EventHandler(lvSelectedIndexChanged);
            lv.FontChanged          += new EventHandler(lvFontChanged);
            lv.KeyDown    += new KeyEventHandler(lvKeyDown);
            lv.MouseClick += new MouseEventHandler(lvMosuseClick);
            lvClientSizeChanged(this, new EventArgs());

            myMenuStrip              = new ContextMenuStrip();
            myMenuStrip.ItemClicked += new ToolStripItemClickedEventHandler(myMenuStripItemClicked);

            this.group = groupDefine;
        }
        public ListViewAdpter(ListView listview, GroupDefineItemCollection groupDefine)
        {
            lv = listview;

            lv.Columns.Clear();
            lv.Columns.Add("No.");
            lv.Columns.Add("Text");
            lv.Columns.Add("Category");
            lv.FullRowSelect = true;
            lv.GridLines = true;
            lv.HideSelection = false;

            lv.MultiSelect = true;
            lv.Scrollable = true;
            lv.HeaderStyle = ColumnHeaderStyle.None;

            lv.ClientSizeChanged += new EventHandler(lvClientSizeChanged);
            lv.SelectedIndexChanged += new EventHandler(lvSelectedIndexChanged);
            lv.FontChanged += new EventHandler(lvFontChanged);
            lv.KeyDown += new KeyEventHandler(lvKeyDown);
            lv.MouseClick += new MouseEventHandler(lvMosuseClick);
            lvClientSizeChanged(this, new EventArgs());

            myMenuStrip = new ContextMenuStrip();
            myMenuStrip.ItemClicked += new ToolStripItemClickedEventHandler(myMenuStripItemClicked);

            this.group = groupDefine;
        }
Example #3
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 GroupButtonAdaptor(ToolStrip toolStrip, GroupDefineItemCollection groupDefines)
        {
            this.toolStrip = toolStrip;
            myButtonGroup = new ToolStripButtonGroup(toolStrip);
            //myButtonGroup.IndexChanged += new EventHandler(buttonGroupSelectChanged);

            Refresh(groupDefines);
        }
Example #5
0
        public GroupButtonAdaptor(ToolStrip toolStrip, GroupDefineItemCollection groupDefines)
        {
            this.toolStrip = toolStrip;
            myButtonGroup  = new ToolStripButtonGroup(toolStrip);
            //myButtonGroup.IndexChanged += new EventHandler(buttonGroupSelectChanged);

            Refresh(groupDefines);
        }
        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;
        }