Наследование: System.Windows.Forms.DataGridViewCell
Пример #1
0
        void BindToDgv(INewsBase news, int typeID, int pageIndex = 1)
        {
            dgv.Rows.Clear();
            if (news != null)
            {
                var newsList = news.GetNewsList(typeID, pageIndex);
                if (newsList == null || newsList.Count <= 0) return;
                foreach (var item in newsList)
                {
                    int index = dgv.Rows.Add();
                    DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
                    cell.Value = item.ID;
                    dgv.Rows[index].Cells["ID"] = cell;

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = item.Title;
                    dgv.Rows[index].Cells["Title"] = cell;

                    cell = new DataGridViewTextBoxCell();
                    cell.Value = item.Source;
                    dgv.Rows[index].Cells["Source"] = cell;

                    DataGridViewButtonCell cellb = new DataGridViewButtonCell();
                    cellb.Value = item.IsGetted ? "تامام" : "يىغىش";
                    dgv.Rows[index].Cells["Make"] = cellb;

                    dgv.Rows[index].Tag = item;
                    if (item.IsGetted)
                    {
                        dgv.Rows[index].DefaultCellStyle = new DataGridViewCellStyle() { ForeColor = Color.Gray };
                    }
                }
            }
        }
Пример #2
0
        private void btnAddProduct_Click(object sender, EventArgs e)
        {
            var af = new AddProductForm();
            if (af.ShowDialog() == DialogResult.OK)
            {
                Product prod=af.Product;

                DataGridViewCell cel0 = new DataGridViewTextBoxCell();
                cel0.Value = prod.Name;

                DataGridViewCell cel1 = new DataGridViewTextBoxCell();
                cel1.Value = prod.AlbumName;

                DataGridViewCell cel2 = new DataGridViewTextBoxCell();
                cel2.Value = prod.Photos.Count;

                DataGridViewRow row = new DataGridViewRow();
                row.Cells.AddRange(cel0, cel1, cel2);

                grid.Rows.Add(row);

                Products.Add(prod);

                btnStart.Enabled = true;
            }
        }
Пример #3
0
        public TableForm(string name, IDataReader rdr)
        {
            DataGridView dgv = new DataGridView();
            dgv.Dock = DockStyle.Fill;
            DataGridViewTextBoxCell template = new DataGridViewTextBoxCell();
            template.Style.Font = new Font("DejaVu Sans",10);
            for (int i = 0;i < rdr.FieldCount;i++)
            {
                DataGridViewColumn col = new DataGridViewColumn(template);
                col.Name = rdr.GetName(i);
                dgv.Columns.Add(col);
            }
            while (rdr.Read())
            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(dgv);
                for (int i = 0;i < rdr.FieldCount;i++)
                {
                    object val = rdr[i];
                    if (val is byte[])
                    {
                        val = Encoding.UTF8.GetString((byte[])val);
                    }
                    row.Cells[i].Value = val;
                }
                dgv.Rows.Add(row);
            }

            Controls.Add(dgv);
        }
Пример #4
0
        public void InitialDataGridView()
        {
            dataGridView.Rows.Clear();
            dataGridView.Columns.Clear();

            DataGridViewCell textCell = new DataGridViewTextBoxCell();
            DataGridViewColumn timeColumn = new DataGridViewColumn();
            timeColumn.HeaderText = "记录时间";
            timeColumn.Width = 160;
            timeColumn.CellTemplate = textCell;
            DataGridViewColumn ipColumn = new DataGridViewColumn();
            ipColumn.HeaderText = "IP地址";
            ipColumn.Width = 120;
            ipColumn.CellTemplate = textCell;
            DataGridViewColumn portColumn = new DataGridViewColumn();
            portColumn.HeaderText = "端口号";
            portColumn.Width = 80;
            portColumn.CellTemplate = textCell;
            DataGridViewColumn statusColumn = new DataGridViewColumn();
            statusColumn.HeaderText = "工作状态";
            statusColumn.Width = 180;
            statusColumn.CellTemplate = textCell;
            dataGridView.Columns.Add(timeColumn);
            dataGridView.Columns.Add(ipColumn);
            dataGridView.Columns.Add(portColumn);
            dataGridView.Columns.Add(statusColumn);
        }
        public void CargarTabla()
        {
            // Format DataGridView
            
            this.dataGridView1.AllowUserToAddRows = false;
            this.dataGridView1.BackgroundColor = this.BackColor;

            this.dataGridView1.RowHeadersWidth = 75;
            
            String [] Semana = {"Lunes", 
                                "Martes", 
                                "Miercoles", 
                                "Jueves", 
                                "Viernes", 
                                "Sabado"
                               };

            // Add columns to DataGridView

            foreach (String item in Semana)
            {
                DataGridViewCheckBoxColumn checkColumn = new DataGridViewCheckBoxColumn();
                checkColumn.Name = "Columna_" + item;
                checkColumn.HeaderText = item;
                checkColumn.Width = 75;
                checkColumn.ReadOnly = true;
                checkColumn.FillWeight = 10; //if the datagridview is resized (on form resize) the checkbox won't take up too much; value is relative to the other columns' fill values
                dataGridView1.Columns.Add(checkColumn);
            }

            // Add rows to DataGridView
            for (int i = 7; i <= 32; i++)
            {
                TimeSpan t = TimeSpan.FromSeconds(25200 + ((i - 7)* 1800));
                dataGridView1.Rows.Add();
                dataGridView1.Rows[i - 7].HeaderCell.Value = t.ToString().Substring(0, 5) ;
            }

            // Sabados no se trabaja hasta las 10
            for (int i = 0; i < 6; i++)
            {
                DataGridViewTextBoxCell TextBoxCell = new DataGridViewTextBoxCell();
                dataGridView1[5, i] = TextBoxCell;
                dataGridView1[5, i].Value = "";
                dataGridView1[5, i].Style.BackColor = Color.Black;
                dataGridView1[5, i].ReadOnly = true;
            }

            // Sabados no se trabaja desde las 5
            for (int i = 16; i <= 25; i++)
            {
                DataGridViewTextBoxCell TextBoxCell = new DataGridViewTextBoxCell();
                dataGridView1[5, i] = TextBoxCell;
                dataGridView1[5, i].Value = "";
                dataGridView1[5, i].Style.BackColor = Color.Black;
                dataGridView1[5, i].ReadOnly = true;
                
            }
            
        }
Пример #6
0
 private void InitGrid(RedComboBox[] comboboxes, RedContext context)
 {
     foreach(RedComboBox cb in comboboxes)
     {
         var row = new DataGridViewRow();
         var c1 = new DataGridViewTextBoxCell();
         c1.Value = cb.Name;
         DataGridViewCell c2;
         if (cb.query.ToLowerInvariant() == "textedit")
         {
             c2 = new DataGridViewTextBoxCell();
             c2.Value = "";
         }
         else
         {
             c2 = new DataGridViewComboBoxCell();
             var t = cb.GetValues(context);
             foreach (DataRow r in t.Rows)
             {
                 (c2 as DataGridViewComboBoxCell).Items.Add(r[0].ToString());
             }
             (c2 as DataGridViewComboBoxCell).Value = (c2 as DataGridViewComboBoxCell).Items[0];
         }
         c2.ReadOnly = false;
         row.Cells.Add(c1);
         row.Cells.Add(c2);
         dataGridView1.Rows.Add(row);
     }
 }
        /// <summary>
        /// Recursively goes through all files in the directory 
        /// and adds them to the MyFilesDB
        /// </summary>
        /// <param name="directory">Current Directory To Search</param>
        private void addDirectory(String directory)
        {
            try
            {
                foreach (String file in Directory.GetFiles(directory))
                {
                    myFilesDb.AddFile(file);
                    DataGridViewRow row = new DataGridViewRow();
                    DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
                    cell.Value = "Hashed: " + file;
                    row.Cells.Add(cell);
                    if (isShown && !gvLog.IsDisposed && !this.IsDisposed)
                    {
                        try
                        {
                            this.Invoke(new MethodInvoker(
                                    delegate()
                                    {
                                        gvLog.Rows.Insert(0, row);
                                    }));
                        }
                        catch { isShown = false; }
                    }

                }
            }
            catch { }

            foreach (String nextDir in Directory.GetDirectories(directory))
            {
                addDirectory(nextDir);
            }
        }
Пример #8
0
        public void DisplayConfigs()
        {
            ConfigList.Rows.Clear();

            foreach (ConfigSet config in Configs)
            {
                DataGridViewRow row = new DataGridViewRow();
                DataGridViewCell cell = new DataGridViewTextBoxCell();

                if (config.DefaultConfig)
                    cell.Value = @"✔";
                else
                    cell.Value = "";
                row.Cells.Add(cell);

                cell = new DataGridViewTextBoxCell();
                cell.Value = config.Name;
                row.Cells.Add(cell);

                cell = new DataGridViewTextBoxCell();
                cell.Value = config.BitSize.ToString();
                row.Cells.Add(cell);

                cell = new DataGridViewTextBoxCell();
                cell.Value = config.ConfigPath;
                row.Cells.Add(cell);

                ConfigList.Rows.Add(row);
            }
        }
Пример #9
0
        public void updateGrid()
        {
            dataGridView1.Rows.Clear();
            dataGridView1.Columns.Clear();

            //style for classroom name
            DataGridViewCell cellStyle = new DataGridViewTextBoxCell();
            cellStyle.Style.BackColor = Color.Wheat;

            DataGridViewButtonColumn deleteButtonColumn = new DataGridViewButtonColumn();

            deleteButtonColumn.Text = "Delete Classroom";
            deleteButtonColumn.UseColumnTextForButtonValue = true;

            DataGridViewButtonColumn updateButtonColumn = new DataGridViewButtonColumn();
            updateButtonColumn.Text = "Update Classroom";

            updateButtonColumn.UseColumnTextForButtonValue = true;

            DataGridViewButtonColumn manageComputersButtonColumn = new DataGridViewButtonColumn();
            manageComputersButtonColumn.Text = "Manage computers";

            manageComputersButtonColumn.UseColumnTextForButtonValue = true;

            dataGridView1.Columns.Add(new DataGridViewColumn(cellStyle));
            dataGridView1.Columns.Add(new DataGridViewCheckBoxColumn());

            dataGridView1.Columns.Add(updateButtonColumn);
            dataGridView1.Columns.Add(manageComputersButtonColumn);
            dataGridView1.Columns.Add(deleteButtonColumn);

            foreach (Classroom classroom in MainProgram.rooms)
                dataGridView1.Rows.Add(classroom.Classroomname,classroom.Projectoravailable);
        }
Пример #10
0
 private void ClientLogWin_Load(object sender, EventArgs e)
 {
     foreach (string msg in _log)
     {
         string[] p = msg.Split('|');
         DataGridViewRow row = new DataGridViewRow();
         if (p.Length == 1)
         {
             DataGridViewCell cell = new DataGridViewImageCell();
             cell.Value = iconList.Images[0];
             row.Cells.Add(cell);
             cell = new DataGridViewTextBoxCell();
             cell.Value = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
             row.Cells.Add(cell);
             cell = new DataGridViewTextBoxCell();
             cell.Value = p[0];
             row.Cells.Add(cell);
         }
         else
         {
             DataGridViewCell cell = new DataGridViewImageCell();
             cell.Value = iconList.Images[Convert.ToInt32(p[0])];
             row.Cells.Add(cell);
             cell = new DataGridViewTextBoxCell();
             cell.Value = p[1];
             row.Cells.Add(cell);
             cell = new DataGridViewTextBoxCell();
             cell.Value = p[2];
             row.Cells.Add(cell);
         }
         row.Height = 17;
         messageList.Rows.Add(row);
         messageList.FirstDisplayedScrollingRowIndex = messageList.Rows.Count - 1;
     }
 }
Пример #11
0
        /// <summary>
        /// �\���Ώۂ̍s���ݒ肷��D
        /// </summary>
        /// <param name="m"></param>
        public void SetMatrix(KrdLab.Lisys.Matrix m)
        {
            this.DataGridView.Rows.Clear();
            this.DataGridView.Columns.Clear();
            if (m == null)
            {
                return;
            }

            for (int c = 0; c < m.ColumnSize; ++c)
            {
                var gridCol = new DataGridViewColumn();
                gridCol.HeaderText = String.Format("[ , {0}]", c);
                gridCol.ReadOnly = true;
                gridCol.SortMode = DataGridViewColumnSortMode.NotSortable;
                this.DataGridView.Columns.Add(gridCol);
            }

            for (int r = 0; r < m.RowSize; ++r)
            {
                var gridRow = new DataGridViewRow();
                gridRow.HeaderCell.Value = String.Format("[{0}, ]", r);
                gridRow.ReadOnly = true;
                var row = m.Rows[r];
                foreach (var v in row)
                {
                    var cell = new DataGridViewTextBoxCell();
                    cell.Value = v.ToString();
                    gridRow.Cells.Add(cell);
                }
                this.DataGridView.Rows.Add(gridRow);
            }
            this.DataGridView.RowHeadersWidth = 100;
        }
Пример #12
0
        public void filldatagrid()
        {
            computersDataGrid.Rows.Clear();
            computersDataGrid.Columns.Clear();

            DataGridViewCell cellStyle = new DataGridViewTextBoxCell();
            cellStyle.Style.BackColor = Color.Wheat;

            DataGridViewButtonColumn deleteButtonColumn = new DataGridViewButtonColumn();

            deleteButtonColumn.Text = "Delete Computer";
            deleteButtonColumn.UseColumnTextForButtonValue = true;

            DataGridViewButtonColumn updateButtonColumn = new DataGridViewButtonColumn();
            updateButtonColumn.Text = "Update Computer";

            updateButtonColumn.UseColumnTextForButtonValue = true;

            DataGridViewButtonColumn viewComputerButtonColumn = new DataGridViewButtonColumn();
            viewComputerButtonColumn.Text = "View computer details";
            viewComputerButtonColumn.UseColumnTextForButtonValue = true;

            DataGridViewButtonColumn moveComputerButtonColumn = new DataGridViewButtonColumn();
            moveComputerButtonColumn.Text = "Move computer";
            moveComputerButtonColumn.UseColumnTextForButtonValue = true;

            computersDataGrid.Columns.Add(new DataGridViewColumn(cellStyle));
            computersDataGrid.Columns.Add(updateButtonColumn);
            computersDataGrid.Columns.Add(deleteButtonColumn);
            computersDataGrid.Columns.Add(viewComputerButtonColumn);
            computersDataGrid.Columns.Add(moveComputerButtonColumn);

            foreach (Computer comp in classroom.Computersinclassroom)
                computersDataGrid.Rows.Add(comp.Computername);
        }
Пример #13
0
        void AddToList(CGoodsData pCGoodsData)
        {
            DataGridViewRow r1 = new DataGridViewRow();

            // 상품 시퀀스
            DataGridViewTextBoxCell cell_seq = new DataGridViewTextBoxCell();
            cell_seq.Value = pCGoodsData.Seq_;
            r1.Cells.Add(cell_seq);

            // 상품명
            DataGridViewTextBoxCell cell_GoodsName = new DataGridViewTextBoxCell();
            cell_GoodsName.Value = pCGoodsData.GoodsName_;
            r1.Cells.Add(cell_GoodsName);

            // 옵션명
            DataGridViewTextBoxCell cell_OptionName = new DataGridViewTextBoxCell();
            cell_OptionName.Value = pCGoodsData.OptionName_;
            r1.Cells.Add(cell_OptionName);

            // 채널
            DataGridViewTextBoxCell cell_Channel = new DataGridViewTextBoxCell();
            cell_Channel.Value = pCGoodsData.ChannelName_;
            r1.Cells.Add(cell_Channel);

            dataGridView_GoodsList.Rows.Add(r1);
        }
Пример #14
0
        public void AddFilesToView(string group)
        {
            Package p = packages._packages.Find(Package => Package._name == group);

            this.form.dataGridView1.BeginInvoke((MethodInvoker)delegate()
            {
                foreach (Item i in p._items)
                {
                    DataGridViewCellStyle style = new DataGridViewCellStyle();
                    style.Alignment = DataGridViewContentAlignment.MiddleCenter;

                    DataGridViewRow row = new DataGridViewRow();

                    DataGridViewTextBoxCell filename = new DataGridViewTextBoxCell();
                    filename.Value = i._file;
                    row.Cells.Add(filename);

                    DataGridViewTextBoxCell status = new DataGridViewTextBoxCell();
                    status.Value = "Unknown";
                    status.Style = style;
                    row.Cells.Add(status);

                    DataGridViewProgressCell download = new DataGridViewProgressCell();
                    download.Value = 0;
                    row.Cells.Add(download);

                    i.row = row;

                    this.form.dataGridView1.Rows.Add(row);
                }
            });
        }
Пример #15
0
        private void AddTimestampColumns()
        {
            DataGridViewCell cell = new DataGridViewTextBoxCell();
            DataGridViewColumn column = new DataGridViewColumn();

            column.HeaderText = "Total Hours";
            column.Name = "TotalHours";
            column.CellTemplate = cell;
            column.ReadOnly = true;

            this.gridTimestamps.Columns.Add( column );

            cell = new DataGridViewTextBoxCell();
            column = new DataGridViewColumn();

            column.HeaderText = "Hourly Rate";
            column.Name = "HourlyRate";
            column.CellTemplate = cell;
            column.ReadOnly = true;

            this.gridTimestamps.Columns.Add( column );

            cell = new DataGridViewTextBoxCell();
            column = new DataGridViewColumn();

            column.HeaderText = "Amount";
            column.Name = "Amount";
            column.CellTemplate = cell;
            column.ReadOnly = true;

            this.gridTimestamps.Columns.Add( column );
        }
Пример #16
0
        public ResultTable(DataGridView dataView, string[] names)                                 // constructor.  Uses array of names for column/row header labels
        {
            m_dataView = dataView;
            m_results = new Result[m_numberOfSequences, m_numberOfSequences];

            for (int i = 0; i < m_numberOfSequences; ++i)
            {
                DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();
                column.HeaderText = "seq" + (i+1);
                column.MaxInputLength = 8;
                column.Width = 50;
                DataGridViewCell cell = new DataGridViewTextBoxCell();
                column.CellTemplate = cell;
                m_dataView.Columns.Add(column);
            }
            for (int j = 0; j < m_numberOfSequences; ++j)
            {
                DataGridViewRow row = new DataGridViewRow();                                    // how can I remove the dumb current cell pointer that makes the header cells so big/obfuscates the header text?
                row.HeaderCell.Value = "seq"+(j+1);
                row.Height = 20;
                for (int i = 0; i < m_numberOfSequences; ++i)
                {
                    DataGridViewCell cell = new DataGridViewTextBoxCell();
                    row.Cells.Add(cell);
                }
                dataView.RowHeadersWidthSizeMode=DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
                m_dataView.Rows.Add(row);
            }
            dataView.CurrentCell = null;
        }
Пример #17
0
        private void SCCInfoFormLoad(object sender, EventArgs e)
        {
            byte DEFAULT_ALPHA = 255;
            for (int i = 0; i < SCCInfo.StrongConnectedComponent.StrongConnectedComponentCount; ++i)
            {
                DataGridViewRow tableRow = new DataGridViewRow();

                DataGridViewTextBoxCell numCell = new DataGridViewTextBoxCell();
                numCell.Value = (i + 1).ToString();

                DataGridViewTextBoxCell color = new DataGridViewTextBoxCell();
                color.Style.BackColor = System.Drawing.Color.FromArgb
                        (DEFAULT_ALPHA, SCCInfo.VertexColors[i].R, SCCInfo.VertexColors[i].G, SCCInfo.VertexColors[i].B);

                DataGridViewTextBoxCell vertices = new DataGridViewTextBoxCell();
                for (int j = 0; j < SCCInfo.StrongConnectedComponent.GetStrongConnegtionComponentVerticesCount(i) - 1; ++j)
                    vertices.Value += (SCCInfo.StrongConnectedComponent.GetVertex(i, j) + 1).ToString() + ", ";
                vertices.Value += (SCCInfo.StrongConnectedComponent.GetVertex(i, SCCInfo.StrongConnectedComponent.GetStrongConnegtionComponentVerticesCount(i) - 1) + 1).ToString();

                tableRow.Cells.Add(numCell);
                tableRow.Cells.Add(color);
                tableRow.Cells.Add(vertices);

                SCCTable.Rows.Add(tableRow);
            }
        }
Пример #18
0
        public static void data_grid(DataGridView dgv_grid)
        {
            dgv_grid.AutoGenerateColumns = true;

            DataGridViewCell Cell_1 = new DataGridViewTextBoxCell();
            DataGridViewCell Cell_2 = new DataGridViewTextBoxCell();
            DataGridViewCell Cell_3 = new DataGridViewTextBoxCell();

            DataGridViewColumn col__from   = new DataGridViewColumn();
            DataGridViewColumn col__to     = new DataGridViewColumn();
            DataGridViewColumn col__length = new DataGridViewColumn();

            col__from.HeaderText   = "Откуда";
            col__to.HeaderText     = "Куда";
            col__length.HeaderText = "Длина";

            col__from.Width   = 110;
            col__to.Width     = 110;
            col__length.Width = 110;

            col__from.CellTemplate   = Cell_1;
            col__to.CellTemplate     = Cell_2;
            col__length.CellTemplate = Cell_3;

            dgv_grid.ReadOnly = false;
            dgv_grid.AllowUserToAddRows = true;
            dgv_grid.AllowUserToDeleteRows = true;
            dgv_grid.Columns.Add(col__from);
            dgv_grid.Columns.Add(col__to);
            dgv_grid.Columns.Add(col__length);
        }
Пример #19
0
        public ResultTable(DataGridView dataView, int numberOfSequences)
        {
            m_dataView = dataView;
            m_numberOfSequences = numberOfSequences;

            m_results = new double[m_numberOfSequences, m_numberOfSequences];

            for (int i = 0; i < m_numberOfSequences; ++i)
            {
                DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();
                column.MaxInputLength = 8;
                column.Width = 50;
                DataGridViewCell cell = new DataGridViewTextBoxCell();
                column.CellTemplate = cell;
                m_dataView.Columns.Add(column);
            }

            for (int j = 0; j < m_numberOfSequences; ++j)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.Height = 20;
                for (int i = 0; i < m_numberOfSequences; ++i)
                {
                    DataGridViewCell cell = new DataGridViewTextBoxCell();
                    //cell.Value = ((double)i);
                    //cell.Value = "asdas";
                    row.Cells.Add(cell);
                }

                m_dataView.Rows.Add(row);
            }
        }
Пример #20
0
        private void bindGrid()
        {
            this.countriesDataGrid.AutoGenerateColumns = false;

            //create the column programatically
            DataGridViewCell cell = new DataGridViewTextBoxCell();
            DataGridViewTextBoxColumn colCountry = new DataGridViewTextBoxColumn()
            {
                CellTemplate = cell,
                Name = "Name",
                HeaderText = "Country Name",
                DataPropertyName = "Name" // Tell the column which property of FileName it should use
            };
            countriesDataGrid.Columns.Add(colCountry);

            DataGridViewTextBoxColumn colCode = new DataGridViewTextBoxColumn()
            {
                CellTemplate = cell,
                Name = "Code",
                HeaderText = "Country Code",
                DataPropertyName = "Code" // Tell the column which property of FileName it should use
            };
            countriesDataGrid.Columns.Add(colCode);

            var list = p.countries.ToList();
            var filenamesList = new BindingList<Country>(list); // <-- BindingList

            //Bind BindingList directly to the DataGrid, no need of BindingSource
            countriesDataGrid.DataSource = filenamesList;
        }
Пример #21
0
        private void button1_Click(object sender, EventArgs e)
        {
            Win32Assembly assembly = ((AssemblyReference)treeView1.SelectedNode.Tag).assembly;

            if (assembly != null)
            {
                List<DataGridViewColumn> columns = new List<DataGridViewColumn>();
                DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                column.HeaderText = "Name";
                columns.Add(column);
                column = new DataGridViewTextBoxColumn();
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                column.HeaderText = "RVA";
                columns.Add(column);
                List<DataGridViewRow> rows = new List<DataGridViewRow>();

                foreach (ExportMethod meth in assembly.LibraryExports)
                {
                    DataGridViewRow row = new DataGridViewRow();
                    DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
                    cell.Value = meth.Name;
                    row.Cells.Add(cell);
                    cell = new DataGridViewTextBoxCell();
                    cell.Value = "0x" + ((long)meth.RVA).ToString("x8").ToUpper();
                    row.Cells.Add(cell);
                    rows.Add(row);
                }

                ListDlg dlg = new ListDlg(columns.ToArray(), rows.ToArray(), "Exports of " + Path.GetFileName(assembly.Path), false);
                dlg.Show();
            }
        }
 private void AddItems(string[] panels, int sections)
 {
     foreach (string panel in panels)
     {
         DataGridViewComboBoxCell reff = new DataGridViewComboBoxCell();
         DataGridViewTextBoxCell txt2A = new DataGridViewTextBoxCell();
         DataGridViewRow dataGridRow = new DataGridViewRow();
         //ComboBox reff = new ComboBox();
         reff.MaxDropDownItems = sections;
         //reff.DataSource =
         txt2A.Value = panel;
         for (int i = 1; i <= sections; i++)
             reff.Items.Add(i);
         try
         {
             dataGridRow.Cells.Add(txt2A);
             dataGridRow.Cells.Add(reff);
             Grid.Rows.Add(dataGridRow);
         }
         catch (Exception e)
         {
             MessageBox.Show(e.Message, "Error");
         }
     }
 }
Пример #23
0
        public void LoadProperties(xTile.ObjectModel.Component component)
        {
            m_dataGridView.Rows.Clear();

            m_newProperties.Clear();
            foreach (KeyValuePair<string, PropertyValue> keyValuePair
                in component.Properties)
            {
                m_newProperties.Add(keyValuePair.Key, keyValuePair.Value);

                DataGridViewRow row = new DataGridViewRow();
                DataGridViewTextBoxCell nameCell = new DataGridViewTextBoxCell();
                nameCell.Value = keyValuePair.Key;
                DataGridViewTextBoxCell valueCell = new DataGridViewTextBoxCell();
                valueCell.Value = keyValuePair.Value.ToString();

                if (keyValuePair.Value.Type == typeof(float)
                    || keyValuePair.Value.Type == typeof(int))
                    valueCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;

                row.Cells.Add(nameCell);
                row.Cells.Add(valueCell);
                m_dataGridView.Rows.Add(row);
            }
        }
Пример #24
0
        public override void LoadDetail()
        {
            lblTableName.Text = "";
            //lblTableDBDesc.Text = "";//db_desc
            //lblTableLocalDesc.Text = "";//local_desc
            txtTableNewDesc.Text = "";//new_desc
            dgvSchema.Rows.Clear();

            this.node = App.Instance.SelectedNode;
            this.view = App.Instance.SelectedNode.Tag as IViewInfo;

            if (this.view != null)
            {
                lblTableName.Text = this.view.RawName;
                //lblTableDBDesc.Text = this.view.Description;//db_desc
                //lblTableLocalDesc.Text = this.view.Attributes.ContainsKey("local_desc") ? this.view.Attributes["local_desc"] : "";//local_desc
                //txtTableNewDesc.Text = this.view.Attributes.ContainsKey("new_desc") ? this.view.Attributes["new_desc"] : "";//new_desc
                txtTableNewDesc.Text = this.view["local_desc"] ?? "";//local_desc

                //foreach (var item in this.view.Columns)
                //{
                //    int index = dgvSchema.Rows.Add();
                //    DataGridViewRow row = dgvSchema.Rows[index];
                //    //row.Tag = item.IsPrimaryKey;
                //    row.Cells[0].Value = item.RawName;
                //    row.Cells[1].Value = SQLHelper.GetFullSqlType(item);
                //    row.Cells[2].Value = item.Nullable ? true : false;
                //    //row.Cells[3].Value = item.Description;
                //    //row.Cells[4].Value = item.Attributes.ContainsKey("local_desc") ? item.Attributes["local_desc"] : "";
                //    //row.Cells[5].Value = item.Attributes.ContainsKey("new_desc") ? item.Attributes["new_desc"] : "";
                //    row.Cells[3].Value = item["local_desc"] ?? "";
                //}

                List<DataGridViewRow> rlist = new List<DataGridViewRow>();
                foreach (var item in this.view.Columns)
                {
                    DataGridViewTextBoxCell col1 = new DataGridViewTextBoxCell();
                    col1.Value = item.RawName;

                    DataGridViewTextBoxCell col2 = new DataGridViewTextBoxCell();
                    col2.Value = SQLHelper.GetFullSqlType(item);

                    DataGridViewCheckBoxCell col3 = new DataGridViewCheckBoxCell();
                    col3.Value = item.Nullable ? true : false;

                    DataGridViewTextBoxCell col4 = new DataGridViewTextBoxCell();
                    col4.Value = item["local_desc"] ?? "";

                    DataGridViewTextBoxCell col5 = new DataGridViewTextBoxCell();

                    DataGridViewRow row = new DataGridViewRow();
                    row.Cells.AddRange(new DataGridViewCell[] { col1, col2, col3, col4, col5 });
                    rlist.Add(row);
                }

                dgvSchema.Rows.AddRange(rlist.ToArray());
            }
        }
Пример #25
0
        public override DataGridViewRow GetRemainCells(DataGridViewRow row)
        {
            DataGridViewRow returnValue = row;
            try
            {
                DataGridViewCellStyle NameCellStyle = new DataGridViewCellStyle(row.DefaultCellStyle);
                DataGridViewCellStyle style = new DataGridViewCellStyle(row.DefaultCellStyle);

                // Determine Style
                switch (ViewType)
                {
                    case ViewTypes.Secondary:
                        style.BackColor = Color.AntiqueWhite;
                        NameCellStyle.BackColor = Color.AntiqueWhite;
                        NameCellStyle.Font = new Font(row.DefaultCellStyle.Font, FontStyle.Bold);
                        break;
                    case ViewTypes.Blank:
                        row.DefaultCellStyle.BackColor = Color.SlateGray;
                        row.DefaultCellStyle.SelectionBackColor = row.DefaultCellStyle.BackColor;
                        break;
                    case ViewTypes.Total:
                        NameCellStyle.Font = new Font(row.DefaultCellStyle.Font, FontStyle.Bold);
                        break;
                    default:
                        NameCellStyle.BackColor = Color.LightSkyBlue;
                        NameCellStyle.Font = new Font(row.DefaultCellStyle.Font, FontStyle.Bold);
                        break;
                }
                // Create the rest of the cells
                switch (ViewType)
                {
                    case ViewTypes.Blank:
                        // Do nothing
                        break;
                    default:
                        var textCell = new DataGridViewTextBoxCell();
                        textCell.Value = DisplayName;
                        textCell.Style = NameCellStyle;
                        returnValue.Cells.Add(textCell);

                        textCell = new DataGridViewTextBoxCell();
                        textCell.Value = Item.FlatLimit;
                        textCell.Style = style;
                        returnValue.Cells.Add(textCell);

                        textCell = new DataGridViewTextBoxCell();
                        textCell.Value = Item.PercentLimit;
                        textCell.Style = style;
                        returnValue.Cells.Add(textCell);
                        break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            return returnValue;
        }
Пример #26
0
        public void ConfobulateControl()
        {
            _control.AutoGenerateColumns = false;
            _control.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            _control.AllowUserToResizeRows = false;
            _control.AllowUserToOrderColumns = false;
            _control.BorderStyle = BorderStyle.None;
            _control.CellBorderStyle = DataGridViewCellBorderStyle.None;
            _control.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            _control.Font = new Font( _control.Font.FontFamily, 8.0F, GraphicsUnit.Point);

            _control.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
            _control.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(255, 72, 78, 83);
            _control.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
            _control.ColumnHeadersDefaultCellStyle.Font = new Font(_control.ColumnHeadersDefaultCellStyle.Font.FontFamily, _control.ColumnHeadersDefaultCellStyle.Font.SizeInPoints, FontStyle.Bold, GraphicsUnit.Point);

            var cellTemplate = new DataGridViewTextBoxCell();
            cellTemplate.Style.ForeColor = Color.White;
            cellTemplate.Style.SelectionBackColor = Color.FromArgb(255, 46, 100, 149);

            var playingColumnTemplate = new DataGridViewImageCell();
            playingColumnTemplate.ValueIsIcon = false;
            playingColumnTemplate.Style.NullValue = null;
            playingColumnTemplate.Style.ForeColor = cellTemplate.Style.ForeColor;
            playingColumnTemplate.Style.SelectionBackColor = cellTemplate.Style.SelectionBackColor;

            var playingColumn = new DataGridViewColumn(playingColumnTemplate);
            playingColumn.Width = 16;
            playingColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
            playingColumn.Name = "";
            playingColumn.Tag = PlayerAppColumnTypes.NowPlaying;
            _control.Columns.Add(playingColumn);

            var titleColumn = new DataGridViewColumn(cellTemplate);
            titleColumn.Name = "Title";
            titleColumn.DataPropertyName = "Title";
            titleColumn.Tag = PlayerAppColumnTypes.Title;
            _control.Columns.Add(titleColumn);

            var artistColumn = new DataGridViewColumn(cellTemplate);
            artistColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            artistColumn.Name = "Artist";
            artistColumn.DataPropertyName = "Artist";
            artistColumn.Tag = PlayerAppColumnTypes.Artist;
            _control.Columns.Add(artistColumn);

            var durationColumn = new DataGridViewColumn(cellTemplate);
            durationColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            durationColumn.Name = "Duration";
            durationColumn.DataPropertyName = "Duration";
            durationColumn.Tag = PlayerAppColumnTypes.Duration;
            _control.Columns.Add(durationColumn);

            _control.RowHeadersVisible = false;
            _control.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            _control.MultiSelect = false;
        }
Пример #27
0
        public void TextBoxTest()
        {
            SWF.DataGridViewTextBoxColumn column = new SWF.DataGridViewTextBoxColumn();
            column.HeaderText = "Edit Column";

            SWF.DataGridViewTextBoxCell cell = new SWF.DataGridViewTextBoxCell();

            ColumnCellTest(column, cell, false);
        }
Пример #28
0
        public void Add_List(CGoodsData pCGoodsData)
        {
            DataGridViewRow r1 = new DataGridViewRow();

            // 시퀀스
            DataGridViewTextBoxCell cell_seq = new DataGridViewTextBoxCell();
            cell_seq.Value = pCGoodsData.Seq_;
            r1.Cells.Add(cell_seq);

            // 상품명
            DataGridViewTextBoxCell cell_Name = new DataGridViewTextBoxCell();
            cell_Name.Value = pCGoodsData.GoodsName_;
            r1.Cells.Add(cell_Name);

            // 옵션명
            DataGridViewTextBoxCell cell_Option = new DataGridViewTextBoxCell();
            cell_Option.Value = pCGoodsData.OptionName_;
            r1.Cells.Add(cell_Option);

            // 채널
            DataGridViewTextBoxCell cell_channel = new DataGridViewTextBoxCell();
            //cell_channel.Value = pCGoodsData.ChannelName_;
            cell_channel.Value = pCGoodsData.ChannelSeq_.ToString();
            r1.Cells.Add(cell_channel);

            // 상품명(닉
            DataGridViewTextBoxCell cell_goods_nick = new DataGridViewTextBoxCell();
            cell_goods_nick.Value = pCGoodsData.GoodsNickName_;
            r1.Cells.Add(cell_goods_nick);

            // 옵션명(닉
            DataGridViewTextBoxCell cell_option_nick = new DataGridViewTextBoxCell();
            cell_option_nick.Value = pCGoodsData.OptionNickName_;
            r1.Cells.Add(cell_option_nick);

            // 권리사
            DataGridViewTextBoxCell cell_Auth = new DataGridViewTextBoxCell();
            cell_Auth.Value = pCGoodsData.AuthoritySeq_;
            r1.Cells.Add(cell_Auth);

            // 크롤러 시퀀스
            DataGridViewTextBoxCell cell_crawler_seq = new DataGridViewTextBoxCell();
            cell_crawler_seq.Value = pCGoodsData.CrawlerSeq_;
            r1.Cells.Add(cell_crawler_seq);

            // 상태
            DataGridViewTextBoxCell cell_State = new DataGridViewTextBoxCell();
            cell_State.Value = pCGoodsData.State_;
            r1.Cells.Add(cell_State);

            // 권리사 로그인 시퀀스
            DataGridViewTextBoxCell cell_AuLogin = new DataGridViewTextBoxCell();
            cell_AuLogin.Value = pCGoodsData.AuthorityLoginSeq_;
            r1.Cells.Add(cell_AuLogin);

            dataGridView_GoodList.Rows.Add(r1);
        }
Пример #29
0
        private void BindGrid(IList<UpdateModel> source)
        {
            //dataGridView1.DataSource = source;
            var col = new DataGridViewTextBoxColumn();
            col.HeaderText = "标题";
            col.Width = 250;
            dataGridView1.Columns.Add(col);

            col = new DataGridViewTextBoxColumn();
            col.HeaderText = "标签";
            col.Width = 200;
            dataGridView1.Columns.Add(col);

            col = new DataGridViewTextBoxColumn();
            col.HeaderText = "摘要";
            col.Width = 200;
            dataGridView1.Columns.Add(col);

            col = new DataGridViewTextBoxColumn();
            col.HeaderText = "状态";
            col.Width = 90;
            dataGridView1.Columns.Add(col);

            foreach (var item in source)
            {
                var row = new DataGridViewRow();

                var cell = new DataGridViewTextBoxCell();
                cell.Value = item.Title;
                row.Cells.Add(cell);

                cell = new DataGridViewTextBoxCell();
                cell.Value = item.Tags;
                row.Cells.Add(cell);

                cell = new DataGridViewTextBoxCell();
                cell.Value = item.Intro;
                row.Cells.Add(cell);

                cell = new DataGridViewTextBoxCell();
                cell.Value = "";
                row.Cells.Add(cell);

                dataGridView1.Rows.Add(row);
            }
            //dataGridView1.
            if (InvokeRequired)
            {
                this.Invoke(new Action(() =>
                {
                    btnUpdate2.Visible = true;
                    this.progressBar1.Visible = true;
                }));
            }
        }
Пример #30
0
		public void Value ()
		{
			DataGridViewTextBoxCell tbc = new DataGridViewTextBoxCell ();
			Assert.IsNull (tbc.Value, "#1");
			tbc.Value = string.Empty;
			Assert.AreEqual (string.Empty, tbc.Value, "#2");
			tbc.Value = 5;
			Assert.AreEqual (5, tbc.Value, "#3");
			tbc.Value = null;
			Assert.IsNull (tbc.Value, "#4");
		}
Пример #31
0
        private void GetThemaByStockCode()
        {
            RichQuery   richQuery   = new RichQuery();
            KiwoomQuery kiwoomQuery = new KiwoomQuery();
            DataTable   dt4         = new DataTable();
            string      strMaxDate  = richQuery.p_TDATEQuery(query: "2", tradeDate: "", fromDate: "", toDate: "", bln3tier: false).Tables[0].Rows[0]["MAX_TRADE_DATE"].ToString();

            richQuery = null;
            richQuery = new RichQuery();

            DataTable dt  = richQuery.p_ThemaQuery(query: "1", THEMA_CODE: lblThema.Text, TGPSEQ_NO: lblThemaGroup.Text, THEMA_NAME: "", WORK_ID: "", bln3tier: false).Tables[0].Copy();
            int       row = 0;

            _clsDataGridViewUtil.RemoveGridViewRow(dgvThemaPerStock);

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    dgvThemaPerStock.Rows.Add();

                    dgvThemaPerStock.Rows[row].Cells["ThemaByStock_THEMA_NAME"].Value = dr["THEMA_NAME"].ToString().Trim();
                    dgvThemaPerStock.Rows[row].Cells["ThemaByStock_STOCK_NAME"].Value = dr["STOCK_NAME"].ToString().Trim();
                    dgvThemaPerStock.Rows[row].Cells["ThemaByStock_STOCK_CODE"].Value = dr["STOCK_CODE"].ToString().Trim();

                    dt4 = kiwoomQuery.p_StockCodeOptInfoQuery(query: "1", stockCode: dr["STOCK_CODE"].ToString().Trim(), stockDate: "", bln3tier: false).Tables[0].Copy();

                    if (dt4 != null)
                    {
                        if (dt4.Rows.Count > 0)
                        {
                            if (_firstCall == false)
                            {
                                foreach (DataColumn dc in dt4.Columns)
                                {
                                    System.Windows.Forms.DataGridViewColumn dgvColumn = new System.Windows.Forms.DataGridViewColumn();
                                    System.Windows.Forms.DataGridViewCell   cell      = new System.Windows.Forms.DataGridViewTextBoxCell();

                                    if (dc.ColumnName.ToString() == "STOCK_CODE" || dc.ColumnName.ToString() == "CALL_TIME")
                                    {
                                        continue;
                                    }

                                    if (dc.ColumnName.ToString() == "CALL_DATE")
                                    {
                                        dgvColumn.CellTemplate = cell;
                                        dgvColumn.HeaderText   = "기준일자";
                                        dgvColumn.Name         = "OPT10001_CALL_DATE";

                                        dgvThemaPerStock.Columns.Add(dgvColumn);

                                        dgvColumn = null;

                                        dgvColumn = new DataGridViewColumn();

                                        dgvColumn.CellTemplate = cell;
                                        dgvColumn.HeaderText   = "대금대비시총";
                                        dgvColumn.Name         = "대금대비시총";

                                        dgvThemaPerStock.Columns.Add(dgvColumn);

                                        continue;
                                    }


                                    dgvColumn.CellTemplate = cell;
                                    dgvColumn.HeaderText   = dc.ColumnName.ToString();
                                    dgvColumn.Name         = dc.ColumnName.ToString();

                                    dgvThemaPerStock.Columns.Add(dgvColumn);
                                }

                                _firstCall = true;
                            }

                            foreach (DataColumn dc in dt4.Columns)
                            {
                                if (dc.ColumnName.ToString() == "STOCK_CODE" || dc.ColumnName.ToString() == "CALL_TIME")
                                {
                                    continue;
                                }

                                if (dc.ColumnName.ToString() == "CALL_DATE")
                                {
                                    dgvThemaPerStock.Rows[row].Cells["OPT10001_CALL_DATE"].Value = dt4.Rows[0][dc.ColumnName.ToString()].ToString();
                                }
                                else
                                {
                                    dgvThemaPerStock.Rows[row].Cells[columnName : dc.ColumnName.ToString()].Value = dt4.Rows[0][dc.ColumnName.ToString()].ToString();
                                }
                            }
                        }
                    }

                    dt = null;
                    dt = new DataTable();

                    row = row + 1;
                }
                SetDataGridView();
            }
        }
Пример #32
-1
		private void AddElementToDataGridView(Param element)
		{
			var row = new DataGridViewRow();
			
			// пустая сточка означет разделитель между 
			// отдельными интерфейсами
			if(element.ParamName == string.Empty)
			{
				dataGridView1.Rows.Add(row);
				return;	
			}
			
			// добавляем первую ячейку
			var cell1 = new DataGridViewTextBoxCell() 
			{
			    Value = element.ParamName + ":"
			};
			cell1.Style.Font = new Font(dataGridView1.Font, FontStyle.Bold);
			row.Cells.Add(cell1);
			
			// добавляем вторую ячейку
			var cell2 = new DataGridViewTextBoxCell() 
			{
			    Value = element.ParamValue
			};
			row.Cells.Add(cell2);

			// добавляем строчку в dataGridView
			dataGridView1.Rows.Add(row);
		}