Beispiel #1
0
        private void clv_DrawItem(object sender, DrawListViewItemEventArgs e)
        {
            ConfigListView lg = (ConfigListView)sender;
            SolidBrush     theBrush1, theBrush2;

            Color     textColour = Txt_Color;
            Rectangle itemBounds = new Rectangle(e.Bounds.Left, e.Bounds.Top, e.Bounds.Width, e.Bounds.Bottom - e.Bounds.Top);

            if (e.Item.Selected)
            {
                theBrush1 = new SolidBrush(BG_Selected);
                e.Graphics.FillRectangle(theBrush1, itemBounds);
                textColour = Color.White;
            }
            else if (e.ItemIndex % 2 == 0)
            {
                theBrush1 = new SolidBrush(BG_ColorEven);
                e.Graphics.FillRectangle(theBrush1, itemBounds);
            }
            else
            {
                theBrush1 = new SolidBrush(BG_ColorOdd);
                e.Graphics.FillRectangle(theBrush1, itemBounds);
            }

            theBrush2 = new SolidBrush(textColour);
            e.Graphics.DrawString(e.Item.Text, lg.Font, theBrush2,
                                  new Rectangle(itemBounds.Left, itemBounds.Top, itemBounds.Width, itemBounds.Bottom - itemBounds.Top), textFormat);
            theBrush1.Dispose();
            theBrush2.Dispose();
        }
Beispiel #2
0
        private void SetColumnWidths()
        {
            ScrollPanel glc           = this.configScrollPanel;
            int         nControlCount = glc.Controls.Count;

            for (int g = 0; g < glc.Controls.Count; g++)
            {
                GroupListView2 glv = (GroupListView2)glc.Controls[g];
                if (glv == null)
                {
                    continue;
                }

                ConfigListView listview = glv.EmbeddLV;
                if (listview == null)
                {
                    continue;
                }

                if (1 < listview.Columns.Count)
                {
                    int nWidth = listview.Width;
                    listview.Columns[0].Width = FirstColumnWidth;
                    listview.Columns[1].Width = nWidth - FirstColumnWidth;
                }
            }
        }
Beispiel #3
0
 private void CleanListBoxes()
 {
     SensorListView.Clear();
     ConfigListView.Clear();
     IRCFListView.Clear();
     LensListView.Clear();
     StiffenerListView.Clear();
     SubstrateListView.Clear();
     FlexListView.Clear();
     CarrierListView.Clear();
     BuildListView.Clear();
     EEEETextBox.Clear();
 }
Beispiel #4
0
        private void AddEmbeddedControl()
        {
            ScrollPanel glc           = this.configScrollPanel;
            int         nControlCount = glc.Controls.Count;

            for (int g = 0; g < glc.Controls.Count; g++)
            {
                GroupListView2 glv = (GroupListView2)glc.Controls[g];
                if (glv == null)
                {
                    continue;
                }

                ConfigListView listview = glv.EmbeddLV;
                if (listview == null)
                {
                    continue;
                }

                string temp;
                for (int i = 0; i < listview.Items.Count; i++)
                {
                    // Add edit box
                    TextBox tb = new TextBox();
                    tb.Size         = new Size(SecondColumnWidth, 40);
                    tb.Font         = new System.Drawing.Font("Arial Narrow", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    tb.BorderStyle  = BorderStyle.FixedSingle;
                    tb.TextAlign    = HorizontalAlignment.Left;
                    tb.AutoSize     = false;
                    tb.Anchor       = ((System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left);
                    tb.BackColor    = TextBoxBackColor;
                    tb.Click       += new System.EventHandler(this.tb_Click);
                    tb.TextChanged += new System.EventHandler(this.tb_TextChanged);

                    ListViewItem lvItemTemp = listview.Items[i];
                    temp    = lvItemTemp.Text;
                    tb.Text = listview.Items[i].SubItems[TextBoxColumn].Text;
                    tb.Tag  = listview.Items[i].SubItems[TextBoxColumn].Tag;

                    // text box
                    ConfigParam2 para2 = listview.Items[i].SubItems[TextBoxColumn].Tag as ConfigParam2;
                    para2.Obj = tb;

                    // Put it in the second column of every row
                    listview.AddEmbeddedControl(tb, TextBoxColumn, lvItemTemp.Index);
                    tb.Dispose();
                }
            }
        }
Beispiel #5
0
        private void AddItem(ref ConfigListView lg, List <ConfigParam2> lstVars, string sSectionName, string sItemDesc, string sItemValue)
        {
            if (lg == null || lstVars == null)
            {
                return;
            }

            ConfigParam2 para2 = new ConfigParam2(sSectionName, sItemDesc, sItemValue, null);

            ListViewItem item = new ListViewItem(sItemDesc);

            ListViewItem.ListViewSubItem subItem1 = new ListViewItem.ListViewSubItem();
            subItem1.Text = sItemValue;
            subItem1.Tag  = para2;
            item.SubItems.Add(subItem1);
            lg.Items.Add(item);
            lstVars.Add(para2);
        }
 private void ConfigureList <T>(ConfigListView <T> view, List <T> list)
 {
     view.Configure(list);
     view.OnChanged += (ConfigListView <T> l) => canvasPreview.InvalidateCanvas(config);
 }
Beispiel #7
0
        private void AddSection(ref ScrollPanel bsp, SectionParam para, List <ConfigParam2> lstVars)
        {
            if (bsp == null || para == null || lstVars == null)
            {
                return;
            }

            GroupListView2 glv2 = new GroupListView2();
            ConfigListView clv  = glv2.EmbeddLV;

            clv.Scrollable = false;

            // Add  columns
            ColumnHeader columnHeader1 = new ColumnHeader();

            columnHeader1.Width     = FirstColumnWidth;
            columnHeader1.TextAlign = HorizontalAlignment.Left;
            columnHeader1.Text      = "Name";

            ColumnHeader columnHeader2 = new ColumnHeader();

            columnHeader2.Width     = SecondColumnWidth;
            columnHeader2.TextAlign = HorizontalAlignment.Left;
            columnHeader2.Text      = "Description";

            clv.Name = para.SectionName;
            clv.Columns.AddRange(new ColumnHeader[] { columnHeader1, columnHeader2 });

            glv2.LabelText = para.SectionName;

            Node   node = para.getNode();
            string configDesc, configValue;
            int    nColumn1Width;

            while (node != null)
            {
                configDesc  = ((TypeList <string>)node).getDesc();
                configValue = ((TypeList <string>)node).getData();

                AddItem(ref clv, lstVars, para.SectionName, configDesc, configValue);

                nColumn1Width    = DetermineWidth(configDesc);
                FirstColumnWidth = nColumn1Width > FirstColumnWidth ? nColumn1Width : FirstColumnWidth;
                node             = node.getNext();
            }

            // Add custom draw
            clv.OwnerDraw = true;
            clv.DrawItem += new DrawListViewItemEventHandler(clv_DrawItem);

            if (clv.RowHeight > LVSmallChange)
            {
                LVSmallChange = clv.RowHeight;
            }

            if (glv2.Height > LVLargeChange)
            {
                LVLargeChange = glv2.Height;
            }

            glv2.SetPreferedHeight();

            bsp.Controls.Add(glv2);
        }