Exemplo n.º 1
0
    private void llbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    {
        LinkLabel l = (LinkLabel)sender;

        if (l.Text == "Downloading")
        {
            return;
        }
        EXControlListViewSubItem subitem = l.Tag as EXControlListViewSubItem;
        ProgressBar p  = subitem.MyControl as ProgressBar;
        Thread      th = new Thread(new ParameterizedThreadStart(UpdateProgressBarMethod));

        th.IsBackground = true;
        th.Start(p);
        ((LinkLabel)sender).Text = "Downloading";
    }
Exemplo n.º 2
0
        private void ListViewBing(PackageInfo packinfo)
        {
            //添加第二列控件    更新包名称     item[0]
            EXListViewItem item = new EXListViewItem(packinfo.Packagename);

            //添加第二列控件    上传路径       item[1]
            EXControls.EXListViewSubItem serverpath = new EXControls.EXListViewSubItem();
            //添加第三列控件   进度            item[2]
            EXControlListViewSubItem cs = new EXControlListViewSubItem();
            ProgressBar b = new ProgressBar();

            b.Tag = item;
            //添加第四列控件   状态            item[3]
            EXControls.EXListViewSubItem status = new EXControls.EXListViewSubItem();
            //添加第五列控件   操作             item[4]
            EXControlListViewSubItem cs1 = new EXControlListViewSubItem();
            LinkLabel llbl = new LinkLabel();

            llbl.Tag          = cs;
            llbl.LinkClicked += new LinkLabelLinkClickedEventHandler(llbl_LinkClicked);

            if (!string.IsNullOrEmpty(packinfo.PubPath) && CommonConst.PACKSTATE_YiFaBu.Equals(packinfo.State))
            {
                serverpath.Text = packinfo.PubPath;
                status.Text     = "已上传";
                b.Maximum       = 100;
                b.Value         = 100;
                llbl.Text       = "重传";
            }
            else
            {
                status.Text = "未上传";
                llbl.Text   = "上传";
            }
            item.SubItems.Add(serverpath);
            item.SubItems.Add(cs);
            item.SubItems.Add(status);
            item.SubItems.Add(cs1);
            item.SubItems.Add(packinfo.Id.ToString());
            item.SubItems.Add(packinfo.Packagepath);
            item.Tag = "true";          //默认是 确认上传
            this.exListView1.AddControlToSubItem(b, cs);
            this.exListView1.AddControlToSubItem(llbl, cs1);
            this.exListView1.Items.Add(item);
        }
        public static void Create(int row)
        {
            _lv.Items.Clear();
            _process.ForEach(item =>
            {
                _lv.Controls.Remove(item);
            });

            _process.Clear();

            for (int i = 0; i < row; i++)
            {
                EXListViewItem           lvi = new EXListViewItem();
                EXControlListViewSubItem cs  = new EXControlListViewSubItem();


                ProgressBar pb = new ProgressBar();

                lvi.SubItems[0].Text = "Đang lấy link.";
                //lvi.SubItems.Add("");
                //lvi.SubItems.Add("0");
                //lvi.SubItems.Add("");
                //lvi.SubItems.Add("");

                _lv.Items.Add(lvi);

                //var s = lvi.Bounds;

                //Rectangle r = lvi.SubItems[1].Bounds;
                //pb.SetBounds(r.X, r.Y - 2, r.Width, r.Height - 4);


                pb.Minimum = 0;
                pb.Maximum = 100;
                pb.Value   = 0;
                pb.Step    = 1;
                lvi.SubItems.Add(cs);
                _lv.AddControlToSubItem(pb, cs);

                // _lv.Controls.Add(pb);
                _process.Add(pb);
            }
        }
Exemplo n.º 4
0
        public void AddControlToSubItem(int col, int row, EXControlListViewSubItem subitem,DockStyle Dock)
        {
            //control.Bounds = subitem.Bounds;
            if (col >= Columns.Count || row >= Items.Count)
                throw new ArgumentOutOfRangeException();

            EmbeddedControl ec;
            ec.Control = subitem.Btn;
            ec.Column = col;
            ec.Row = row;
            ec.Dock = Dock;
            ec.Item = Items[row];

            _embeddedControls.Add(ec);

            subitem.Btn.Bounds = subitem.Bounds;
            subitem.Btn.Click += new EventHandler(SubItemBtn_Click);
            this.Controls.Add(subitem.Btn);
        }
Exemplo n.º 5
0
        private void llbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LinkLabel l = (LinkLabel)sender;
            EXControlListViewSubItem subitem = l.Tag as EXControlListViewSubItem;
            ProgressBar  p          = subitem.MyControl as ProgressBar;
            ListViewItem item       = (ListViewItem)p.Tag;
            string       serverpath = item.SubItems[1].Text;

            if (!l.Text.Equals("上传") && !l.Text.Equals("重传"))
            {
                item.Tag = "false";
            }
            else
            {
                item.Tag = "true";
                if (string.IsNullOrEmpty(serverpath))
                {
                    System.DateTime today    = System.DateTime.Now;
                    string          todaystr = today.ToString("yyyyMMdd");
                    DialogResult    mr       = MessageBox.Show("是否使用当前日期“" + todaystr + "“作为文件夹?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (DialogResult.Yes == mr)
                    {
                        item.SubItems[1].Text = todaystr;
                        serverpath            = todaystr;
                    }
                    else
                    {
                        return;
                    }
                }

                Thread th = new Thread(new ParameterizedThreadStart(UpdateProgressBarMethod));
                th.IsBackground = true;

                UploadParam up = new UploadParam();
                up.PackPath   = item.SubItems[6].Text;            //@"D:\111.txt";
                up.Bar        = p;
                up.ServerPath = serverpath;
                th.Start(up);
                l.Text = "取消";
            }
        }
Exemplo n.º 6
0
        private void llbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LinkLabel l = (LinkLabel)sender;
            EXControlListViewSubItem subitem = l.Tag as EXControlListViewSubItem;
            ProgressBar  p          = subitem.MyControl as ProgressBar;
            ListViewItem item       = (ListViewItem)p.Tag;
            string       serverpath = item.SubItems[1].Text;

            if (string.IsNullOrEmpty(serverpath))
            {
                SelectPath sp = new SelectPath();
                sp.StartPosition = FormStartPosition.CenterParent;
                if (sp.ShowDialog() == DialogResult.OK)
                {
                    serverpath = sp.selpath;

                    item.SubItems[1].Text = serverpath;
                    sp.Dispose();
                }
                else
                {
                    sp.Dispose();
                    return;
                }
            }

            if (l.Text == "正在上传")
            {
                return;
            }
            Thread th = new Thread(new ParameterizedThreadStart(UpdateProgressBarMethod));

            th.IsBackground = true;

            UploadParam up = new UploadParam();

            up.PackPath   = @"D:\111.txt";
            up.Bar        = p;
            up.ServerPath = serverpath;
            th.Start(up);
            ((LinkLabel)sender).Text = "正在上传";
        }
Exemplo n.º 7
0
        public MainForm()
        {
            InitializeComponent();
            fSyncContext    = SynchronizationContext.Current;
            fCurrentDigest  = new Digest();
            fPreviousDigest = new Digest();

            fProcessorCores = FCCore.GetProcessorsCount();
            fCoreBusy       = new bool[fProcessorCores];
            Array.Clear(fCoreBusy, 0, fProcessorCores);

            Text = "ProcessorsCount: " + fProcessorCores;

            lvFolders.Columns.Add("Folder", 300);

            exListView1.Columns.Add("File", 200);
            exListView1.Columns.Add("Progress", 200);

            lvFiles.Columns.Add("File", 400);
            lvFiles.Columns.Add("Hash", 300);
            lvFiles.Columns.Add("Type", 200);

            fListItems    = new EXListViewItem[fProcessorCores];
            fProgressBars = new ProgressBar[fProcessorCores];
            for (int i = 0; i < fProcessorCores; i++)
            {
                EXListViewItem           item = new EXListViewItem("Item " + i);
                EXControlListViewSubItem cs   = new EXControlListViewSubItem();
                ProgressBar b = new ProgressBar();
                b.Minimum = 0;
                b.Maximum = 100;
                b.Step    = 1;
                item.SubItems.Add(cs);
                exListView1.AddControlToSubItem(b, cs);
                exListView1.Items.Add(item);

                fListItems[i]    = item;
                fProgressBars[i] = b;
            }
        }
Exemplo n.º 8
0
        //开始清洗工作并开始计时
        public void StartTask(TaskInfo info)
        {
            try
            {
                EXListView iTaskList = TaskList[info.Group];
                if (iTaskList.InvokeRequired)
                {
                    UpdateTaskList updatedelegate = new UpdateTaskList(StartTask);
                    ParentForm.Invoke(updatedelegate, new object[] { info });
                }
                else
                {
                    ListViewItem foundItem = iTaskList.FindItemWithText(info.Card, true, 0);    //参数1:要查找的文本;参数2:是否子项也要查找;参数3:开始查找位置

                    {
                        foundItem.SubItems[3].Text = info.errorInfo;
                    }
                    if (info.bStart)
                    {
                        if (info.Step > 1)
                        {
                            EXControlListViewSubItem Stopsubitem = foundItem.SubItems[info.Step + 2] as EXControlListViewSubItem;
                            SkinProgressBar          Stopp       = Stopsubitem.MyControl as SkinProgressBar;
                            progressList.Add(Stopp);
                        }

                        EXControlListViewSubItem subitem = foundItem.SubItems[info.Step + 3] as EXControlListViewSubItem;
                        SkinProgressBar          p       = subitem.MyControl as SkinProgressBar;
                        p.Maximum = info.Time * 10;
                        Thread th = new Thread(new ParameterizedThreadStart(UpdateProgressBarMethod));
                        th.IsBackground = true;
                        th.Start(p);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(Exception), ex);
            }
        }
Exemplo n.º 9
0
        public void AddControlToSubItem(int col, int row, EXControlListViewSubItem subitem, DockStyle Dock)
        {
            //control.Bounds = subitem.Bounds;
            if (col >= Columns.Count || row >= Items.Count)
            {
                throw new ArgumentOutOfRangeException();
            }

            EmbeddedControl ec;

            ec.Control = subitem.Btn;
            ec.Column  = col;
            ec.Row     = row;
            ec.Dock    = Dock;
            ec.Item    = Items[row];

            _embeddedControls.Add(ec);

            subitem.Btn.Bounds = subitem.Bounds;
            subitem.Btn.Click += new EventHandler(SubItemBtn_Click);
            this.Controls.Add(subitem.Btn);
        }
Exemplo n.º 10
0
        public void Endupdate(TaskInfo info)
        {
            EXListView iTaskList = TaskList[info.Group];

            if (iTaskList.InvokeRequired)
            {
                UpdateTaskList updatedelegate = new UpdateTaskList(Endupdate);
                ParentForm.Invoke(updatedelegate, new object[] { info });
            }
            else
            {
                ListViewItem foundItem = iTaskList.FindItemWithText(info.Card, false, 0);    //参数1:要查找的文本;参数2:是否子项也要查找;参数3:开始查找位置

                for (int i = 4; i < iTaskList.Columns.Count; i++)
                {
                    EXControlListViewSubItem subitem = foundItem.SubItems[i] as EXControlListViewSubItem;
                    iTaskList.RemoveControlFromSubItem(subitem);
                }

                iTaskList.Items.Remove(foundItem);
            }
        }
Exemplo n.º 11
0
        private void InitControls(EXListViewItem item)
        {
            EXControlListViewSubItem itemcBox = new EXControlListViewSubItem();
            ComboBox cbBox = new ComboBox();

            cbBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            cbBox.SelectedIndexChanged += ComboBox1_SelectedIndexChanged;
            cbBox.Items.Add("直线插补");
            cbBox.Items.Add("圆弧插补");
            cbBox.SelectedIndex = 0;

            EXControlListViewSubItem itemText = new EXControlListViewSubItem();
            TextBox textBox = new TextBox();

            EXControlListViewSubItem itemLaser = new EXControlListViewSubItem();
            Button btnLaser = new Button();

            btnLaser.Click   += Button_Click;
            btnLaser.AutoSize = true;
            btnLaser.Text     = "OFF";

            EXControlListViewSubItem itemDelay = new EXControlListViewSubItem();
            NumericUpDown            delayTime = new NumericUpDown();

            delayTime.Maximum   = 10000;
            delayTime.Minimum   = 0;
            delayTime.Value     = 0;
            delayTime.TextAlign = HorizontalAlignment.Right;

            exListView1.AddControlToSubItem(cbBox, itemcBox);
            exListView1.AddControlToSubItem(textBox, itemText);
            exListView1.AddControlToSubItem(btnLaser, itemLaser);
            exListView1.AddControlToSubItem(delayTime, itemDelay);

            item.SubItems.Add(itemcBox);
            item.SubItems.Add(itemText);
            item.SubItems.Add(itemLaser);
            item.SubItems.Add(itemDelay);
        }
Exemplo n.º 12
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            exListView1.SelectedIndexChanged += exListView1_SelectedIndexChanged;

            List <string> lines = new List <string>();

            if (exListView1.SelectedIndices.Count <= 0)
            {
                MessageBox.Show("你未选择任何数据!");
                return;
            }

            //MessageBox.Show(exListView1.SelectedIndices.Count + "....");

            try
            {
                for (int i = 0; i < this.exListView1.SelectedIndices.Count; i++)
                {
                    int index = exListView1.SelectedIndices[i];

                    EXListViewItem itemName = exListView1.Items[index] as EXListViewItem;

                    EXControlListViewSubItem itemCmbox  = itemName.SubItems[1] as EXControlListViewSubItem;
                    EXControlListViewSubItem itemTxtBox = itemName.SubItems[2] as EXControlListViewSubItem;
                    EXControlListViewSubItem itemLaser  = itemName.SubItems[3] as EXControlListViewSubItem;
                    EXControlListViewSubItem itemDelay  = itemName.SubItems[4] as EXControlListViewSubItem;

                    ComboBox      cbBox    = itemCmbox.MyControl as ComboBox;
                    TextBox       txtBox   = itemTxtBox.MyControl as TextBox;
                    Button        btnLaser = itemLaser.MyControl as Button;
                    NumericUpDown numDelay = itemDelay.MyControl as NumericUpDown;

                    lines.Add(String.Format("序号#{0}\r\n指令#{1}\r\n代码#{2}\r\n激光状态#{3}\r\n延迟时间#{4}",
                                            itemName.Text, cbBox.Text, txtBox.Text, btnLaser.Text, numDelay.Text));
                }
            }
            catch (Exception ex)
            {
                m_main.AddLog(ex.Message, true, true);
                return;
            }

            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Title            = "保存";
            dialog.Filter           = "文本 |*.txt|所有文件 |*.*";
            dialog.RestoreDirectory = true;
            dialog.InitialDirectory = Application.StartupPath;

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    string fileName = dialog.FileName;

                    File.WriteAllLines(fileName, lines);

                    m_main.ListParams = m_listParams;
                    labSum.Text       = labSum.Text + ",保存成功!";
                }
                catch (Exception ex)
                {
                    m_main.AddLog(ex.Message, true, true);
                }
            }
        }
Exemplo n.º 13
0
        private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Title            = "打开文件";
            dialog.Filter           = "文本 |*.txt| 所有文件|*.*";
            dialog.RestoreDirectory = true;
            dialog.InitialDirectory = Application.StartupPath;

            if (DialogResult.OK == dialog.ShowDialog())
            {
                string fileName = dialog.FileName;
                CodeFileName = fileName;

                string[] lines = File.ReadAllLines(fileName, Encoding.UTF8);

                int count = lines.Length / 5;

                int rate = 1;
                try
                {
                    for (int i = 0; i < count; i++)
                    {
                        exListView1.BeginUpdate();

                        EXListViewItem it = exListView1.Items[exListView1.Items.Count - 1] as EXListViewItem;

                        string index = it.Text;

                        EXListViewItem item = new EXListViewItem(Convert.ToInt32(index) + 1 + "");

                        EXControlListViewSubItem itemcBox = new EXControlListViewSubItem();
                        ComboBox cbBox = new ComboBox();
                        cbBox.DropDownStyle         = ComboBoxStyle.DropDownList;
                        cbBox.SelectedIndexChanged += ComboBox1_SelectedIndexChanged;
                        cbBox.Items.Add("直线插补");
                        cbBox.Items.Add("圆弧插补");
                        cbBox.Text = lines[rate].Split('#')[1];

                        EXControlListViewSubItem itemText = new EXControlListViewSubItem();
                        TextBox textBox = new TextBox();
                        textBox.Text = lines[rate + 1].Split('#')[1];
                        m_listParams.Add(textBox.Text);

                        EXControlListViewSubItem itemLaser = new EXControlListViewSubItem();
                        Button btnLaser = new Button();
                        btnLaser.AutoSize = true;
                        btnLaser.Click   += Button_Click;
                        btnLaser.Text     = lines[rate + 2].Split('#')[1];

                        EXControlListViewSubItem itemDelay = new EXControlListViewSubItem();
                        NumericUpDown            delayTime = new NumericUpDown();
                        delayTime.Maximum   = 10000;
                        delayTime.Minimum   = 0;
                        delayTime.Value     = Convert.ToDecimal(lines[rate + 3].Split('#')[1]);
                        delayTime.TextAlign = HorizontalAlignment.Right;

                        exListView1.AddControlToSubItem(cbBox, itemcBox);
                        exListView1.AddControlToSubItem(textBox, itemText);
                        exListView1.AddControlToSubItem(btnLaser, itemLaser);
                        exListView1.AddControlToSubItem(delayTime, itemDelay);

                        item.SubItems.Add(itemcBox);
                        item.SubItems.Add(itemText);
                        item.SubItems.Add(itemLaser);
                        item.SubItems.Add(itemDelay);

                        exListView1.Items.Add(item);

                        exListView1.EndUpdate();
                        rate += 5;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                int l = m_listParams.Count;
            }
        }
Exemplo n.º 14
0
    private void InitializeComponent()
    {
        //imglst_genre
        ImageList imglst_genre = new ImageList();

        imglst_genre.ColorDepth = ColorDepth.Depth32Bit;
        imglst_genre.Images.Add(Image.FromFile("music.png"));
        imglst_genre.Images.Add(Image.FromFile("love.png"));
        imglst_genre.Images.Add(Image.FromFile("comedy.png"));
        imglst_genre.Images.Add(Image.FromFile("drama.png"));
        imglst_genre.Images.Add(Image.FromFile("horror.ico"));
        imglst_genre.Images.Add(Image.FromFile("family.ico"));
        //excmbx_genre
        EXComboBox excmbx_genre = new EXComboBox();

        excmbx_genre.DropDownStyle    = ComboBoxStyle.DropDownList;
        excmbx_genre.MyHighlightBrush = Brushes.Goldenrod;
        excmbx_genre.ItemHeight       = 20;
        excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[0], "Music"));
        excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[1], "Romantic"));
        excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[2], "Comedy"));
        excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[3], "Drama"));
        excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[4], "Horror"));
        excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[5], "Family"));
        excmbx_genre.Items.Add(new EXComboBox.EXMultipleImagesItem(new ArrayList(new object[] { Image.FromFile("love.png"), Image.FromFile("comedy.png") }), "Romantic comedy"));
        //excmbx_rate
        EXComboBox excmbx_rate = new EXComboBox();

        excmbx_rate.MyHighlightBrush = Brushes.Goldenrod;
        excmbx_rate.DropDownStyle    = ComboBoxStyle.DropDownList;
        ImageList imglst_rate = new ImageList();

        imglst_rate.ColorDepth = ColorDepth.Depth32Bit;
        imglst_rate.Images.Add(Image.FromFile("rate.png"));
        for (int i = 1; i < 6; i++)
        {
            ArrayList _arlst1 = new ArrayList();
            for (int j = 0; j < i; j++)
            {
                _arlst1.Add(imglst_rate.Images[0]);
            }
            excmbx_rate.Items.Add(new EXComboBox.EXMultipleImagesItem("", _arlst1, i.ToString()));
        }
        //lstv
        lstv                  = new EXListView();
        lstv.MySortBrush      = SystemBrushes.ControlLight;
        lstv.MyHighlightBrush = Brushes.Goldenrod;
        lstv.GridLines        = true;
        lstv.Location         = new Point(10, 40);
        lstv.Size             = new Size(500, 400);
        lstv.ControlPadding   = 4;
        lstv.MouseMove       += new MouseEventHandler(lstv_MouseMove);
        lstv.Anchor           = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
        //add SmallImageList to ListView - images will be shown in ColumnHeaders
        ImageList colimglst = new ImageList();

        colimglst.Images.Add("down", Image.FromFile("down.png"));
        colimglst.Images.Add("up", Image.FromFile("up.png"));
        colimglst.ColorDepth = ColorDepth.Depth32Bit;
        colimglst.ImageSize  = new Size(20, 20);        // this will affect the row height
        lstv.SmallImageList  = colimglst;
        //add columns and items
        lstv.Columns.Add(new EXEditableColumnHeader("Movie", 20));
        lstv.Columns.Add(new EXColumnHeader("Progress", 120));
        lstv.Columns.Add(new EXEditableColumnHeader("Genre", excmbx_genre, 60));
        lstv.Columns.Add(new EXEditableColumnHeader("Rate", excmbx_rate, 100));
        lstv.Columns.Add(new EXColumnHeader("Status", 80));
        EXBoolColumnHeader boolcol = new EXBoolColumnHeader("Conclusion", 80);

        boolcol.Editable   = true;
        boolcol.TrueImage  = Image.FromFile("true.png");
        boolcol.FalseImage = Image.FromFile("false.png");
        lstv.Columns.Add(boolcol);
        lstv.BeginUpdate();
        for (int i = 0; i < 100; i++)
        {
            //movie
            EXListViewItem           item = new EXListViewItem(i.ToString());
            EXControlListViewSubItem cs   = new EXControlListViewSubItem();
            ProgressBar b = new ProgressBar();
            b.Tag     = item;
            b.Minimum = 0;
            b.Maximum = 1000;
            b.Step    = 1;
            item.SubItems.Add(cs);
            lstv.AddControlToSubItem(b, cs);
            //genre
            item.SubItems.Add(new EXMultipleImagesListViewSubItem(new ArrayList(new object[] { imglst_genre.Images[1], imglst_genre.Images[2] }), "Romantic comedy"));
            //rate
            item.SubItems.Add(new EXMultipleImagesListViewSubItem(new ArrayList(new object[] { imglst_rate.Images[0] }), "1"));
            //cancel and resume
            EXControlListViewSubItem cs1 = new EXControlListViewSubItem();
            LinkLabel llbl = new LinkLabel();
            llbl.Text         = "Start";
            llbl.Tag          = cs;
            llbl.LinkClicked += new LinkLabelLinkClickedEventHandler(llbl_LinkClicked);
            item.SubItems.Add(cs1);
            lstv.AddControlToSubItem(llbl, cs1);
            //conclusion
            item.SubItems.Add(new EXBoolListViewSubItem(true));
            lstv.Items.Add(item);
        }
        lstv.EndUpdate();
        //statusstrip1
        statusstrip1.Items.AddRange(new ToolStripItem[] { toolstripstatuslabel1 });
        //btn
        btn.Location = new Point(10, 450);
        btn.Text     = "Remove Control";
        btn.AutoSize = true;
        btn.Click   += new EventHandler(btn_Click);
        //btn2
        btn2.Location = new Point(btn.Right + 20, 450);
        btn2.Text     = "Remove Image";
        btn2.AutoSize = true;
        btn2.Click   += new EventHandler(btn2_Click);
        //this
        this.ClientSize = new Size(520, 510);
        this.Controls.Add(statusstrip1);
        Label lbl = new Label();

        lbl.Text   = "Doubleclick on the subitems to edit...";
        lbl.Bounds = new Rectangle(10, 10, 480, 20);
        this.Controls.Add(lbl);
        this.Controls.Add(lstv);
        this.Controls.Add(btn);
        this.Controls.Add(btn2);
    }
Exemplo n.º 15
0
	private void InitializeComponent() {
		//imglst_genre
		ImageList imglst_genre = new ImageList();
		imglst_genre.ColorDepth = ColorDepth.Depth32Bit;
		imglst_genre.Images.Add(Image.FromFile("music.png"));
		imglst_genre.Images.Add(Image.FromFile("love.png"));
		imglst_genre.Images.Add(Image.FromFile("comedy.png"));
		imglst_genre.Images.Add(Image.FromFile("drama.png"));
		imglst_genre.Images.Add(Image.FromFile("horror.ico"));
		imglst_genre.Images.Add(Image.FromFile("family.ico"));
		//excmbx_genre
		EXComboBox excmbx_genre = new EXComboBox();
		excmbx_genre.DropDownStyle = ComboBoxStyle.DropDownList;
		excmbx_genre.MyHighlightBrush = Brushes.Goldenrod;
		excmbx_genre.ItemHeight = 20;
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[0], "Music"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[1], "Romantic"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[2], "Comedy"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[3], "Drama"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[4], "Horror"));
		excmbx_genre.Items.Add(new EXComboBox.EXImageItem(imglst_genre.Images[5], "Family"));
		excmbx_genre.Items.Add(new EXComboBox.EXMultipleImagesItem(new ArrayList(new object[] {Image.FromFile("love.png"), Image.FromFile("comedy.png")}), "Romantic comedy"));
		//excmbx_rate
		EXComboBox excmbx_rate = new EXComboBox();
		excmbx_rate.MyHighlightBrush = Brushes.Goldenrod;
		excmbx_rate.DropDownStyle = ComboBoxStyle.DropDownList;
		ImageList imglst_rate = new ImageList();
		imglst_rate.ColorDepth = ColorDepth.Depth32Bit;
		imglst_rate.Images.Add(Image.FromFile("rate.png"));
		for (int i = 1; i < 6; i++) {
			ArrayList _arlst1 = new ArrayList();
			for (int j = 0; j < i; j++) {
				_arlst1.Add(imglst_rate.Images[0]);
			}
			excmbx_rate.Items.Add(new EXComboBox.EXMultipleImagesItem("", _arlst1, i.ToString()));
		}
		//lstv
		lstv = new EXListView();
		lstv.MySortBrush = SystemBrushes.ControlLight;
		lstv.MyHighlightBrush = Brushes.Goldenrod;
		lstv.GridLines = true;
		lstv.Location = new Point(10, 40);
		lstv.Size = new Size(500, 400);
		lstv.ControlPadding = 4;
		lstv.MouseMove += new MouseEventHandler(lstv_MouseMove);
		lstv.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
		//add SmallImageList to ListView - images will be shown in ColumnHeaders
		ImageList colimglst = new ImageList();
		colimglst.Images.Add("down", Image.FromFile("down.png"));
		colimglst.Images.Add("up", Image.FromFile("up.png"));
		colimglst.ColorDepth = ColorDepth.Depth32Bit;
		colimglst.ImageSize = new Size(20, 20); // this will affect the row height
		lstv.SmallImageList = colimglst;
		//add columns and items
		lstv.Columns.Add(new EXEditableColumnHeader("Movie", 20));
		lstv.Columns.Add(new EXColumnHeader("Progress", 120));
		lstv.Columns.Add(new EXEditableColumnHeader("Genre", excmbx_genre, 60));
		lstv.Columns.Add(new EXEditableColumnHeader("Rate", excmbx_rate, 100));
		lstv.Columns.Add(new EXColumnHeader("Status", 80));
		EXBoolColumnHeader boolcol = new EXBoolColumnHeader("Conclusion", 80);
		boolcol.Editable = true;
		boolcol.TrueImage = Image.FromFile("true.png");
		boolcol.FalseImage = Image.FromFile("false.png");
		lstv.Columns.Add(boolcol);
		lstv.BeginUpdate();
		for (int i = 0; i < 100; i++) {
			//movie
			EXListViewItem item = new EXListViewItem(i.ToString());
			EXControlListViewSubItem cs = new EXControlListViewSubItem();
			ProgressBar b = new ProgressBar();
			b.Tag = item;
			b.Minimum = 0;
			b.Maximum = 1000;
			b.Step = 1;
			item.SubItems.Add(cs);
			lstv.AddControlToSubItem(b, cs);
			//genre
			item.SubItems.Add(new EXMultipleImagesListViewSubItem(new ArrayList(new object[] {imglst_genre.Images[1], imglst_genre.Images[2]}), "Romantic comedy"));
			//rate
			item.SubItems.Add(new EXMultipleImagesListViewSubItem(new ArrayList(new object[] {imglst_rate.Images[0]}), "1"));
			//cancel and resume
			EXControlListViewSubItem cs1 = new EXControlListViewSubItem();
			LinkLabel llbl = new LinkLabel();
			llbl.Text = "Start";
			llbl.Tag = cs;
			llbl.LinkClicked += new LinkLabelLinkClickedEventHandler(llbl_LinkClicked);
			item.SubItems.Add(cs1);
			lstv.AddControlToSubItem(llbl, cs1);
			//conclusion
			item.SubItems.Add(new EXBoolListViewSubItem(true));
			lstv.Items.Add(item);
		}
		lstv.EndUpdate();
		//statusstrip1
		statusstrip1.Items.AddRange(new ToolStripItem[] {toolstripstatuslabel1});
		//btn
		btn.Location = new Point(10, 450);
		btn.Text = "Remove Control";
		btn.AutoSize = true;
		btn.Click += new EventHandler(btn_Click);
		//btn2
		btn2.Location = new Point(btn.Right + 20, 450);
		btn2.Text = "Remove Image";
		btn2.AutoSize = true;
		btn2.Click += new EventHandler(btn2_Click);
		//this
		this.ClientSize = new Size(520, 510);
		this.Controls.Add(statusstrip1);
		Label lbl = new Label();
		lbl.Text = "Doubleclick on the subitems to edit...";
		lbl.Bounds = new Rectangle(10, 10, 480, 20);
		this.Controls.Add(lbl);
		this.Controls.Add(lstv);
		this.Controls.Add(btn);
		this.Controls.Add(btn2);
	}