private void CreateCells() { ImageCell = new DataGridViewImageCell(false); ImageCell.ValueType = typeof(Image); MacCell = new DataGridViewTextBoxCell(); NetworkCell = new DataGridViewTextBoxCell(); Cells.AddRange(new DataGridViewCell[] { ImageCell, MacCell, NetworkCell }); UpdateDetails(); }
void AddRow(opponent_goods goods) { try { DataGridViewRow row = new DataGridViewRow(); DataGridViewTextBoxCell txt1 = new DataGridViewTextBoxCell(); txt1.Value = goods.ogTBid; row.Cells.Add(txt1); DataGridViewImageCell img1 = new DataGridViewImageCell(); img1.Value = goods.ogimg; row.Cells.Add(img1); DataGridViewTextBoxCell txt2 = new DataGridViewTextBoxCell(); txt2.Value = goods.ogtittle; row.Cells.Add(txt2); DataGridViewTextBoxCell txt3 = new DataGridViewTextBoxCell(); txt3.Value = goods.ogsales; row.Cells.Add(txt3); DataGridViewTextBoxCell txt4 = new DataGridViewTextBoxCell(); txt4.Value = goods.ogshoucang; row.Cells.Add(txt4); DataGridViewTextBoxCell txt5 = new DataGridViewTextBoxCell(); txt5.Value = goods.ogxiaoliang; row.Cells.Add(txt5); DataGridViewTextBoxCell txt6 = new DataGridViewTextBoxCell(); txt6.Value = goods.ogprice1; row.Cells.Add(txt6); DataGridViewTextBoxCell txt7 = new DataGridViewTextBoxCell(); txt7.Value = goods.ogprice2; row.Cells.Add(txt7); DataGridViewTextBoxCell txt8 = new DataGridViewTextBoxCell(); txt8.Value = Manager.GetZheKou(goods.ogprice1, goods.ogprice2).ToString(); row.Cells.Add(txt8); DataGridViewTextBoxCell txt9 = new DataGridViewTextBoxCell(); txt9.Value = goods.ogpostage; row.Cells.Add(txt9); DataGridViewTextBoxCell txt10 = new DataGridViewTextBoxCell(); txt10.Value = goods.ogSKU; row.Cells.Add(txt10); DataGridViewTextBoxCell txt11 = new DataGridViewTextBoxCell(); txt11.Value = goods.ocollectdate; row.Cells.Add(txt11); //DataGridViewComboBoxCell comboxcell = new DataGridViewComboBoxCell(); //row.Cells.Add(comboxcell); dgv1.Rows.Add(row); } catch (Exception ex) { Debug.WriteLine("======================================================================"); Debug.WriteLine("网址:" + Browser.urlstr); Debug.WriteLine(DateTime.Now.ToString()); Debug.WriteLine("全店采集信息失败:" + ex.Message); MessageBox.Show("全店采集信息失败:" + ex.Message); } }
public void DrawStatusIcon(int rowIndex, LicenseDataGridViewRow.Status status) { Program.Invoke(Program.MainWindow, delegate { SuspendLayout(); try { if (StatusImageColumn == null) { return; } if (rowIndex < 0 || rowIndex >= Rows.Count) { return; } var r = Rows[rowIndex]; if (StatusImageColumn.Index >= r.Cells.Count) { return; } DataGridViewCell cell = new DataGridViewImageCell { ValueIsIcon = true, ValueType = typeof(Bitmap), Value = new Bitmap(1, 1) }; if (status == LicenseDataGridViewRow.Status.Information) { cell.Value = Resources._000_Alert2_h32bit_16; } if (status == LicenseDataGridViewRow.Status.Warning) { cell.Value = Resources._000_error_h32bit_16; } if (status == LicenseDataGridViewRow.Status.Ok) { cell.Value = Resources._000_Tick_h32bit_16; } if (r.Cells[StatusImageColumn.Index] is DataGridViewImageCell) { r.Cells[StatusImageColumn.Index] = cell; } } finally { ResumeLayout(); } }); }
public static void administrarImagendgv(DataGridView cuadro) { foreach (DataGridViewRow row in cuadro.Rows) { DataGridViewImageCell cell = row.Cells[0] as DataGridViewImageCell; if (Convert.ToString(row.Cells[7].Value) == "Pendiente") { cell.Value = (System.Drawing.Image)Properties.Resources.Warning_16x16; } } }
private void DgvSocios_CellContentClick(object sender, DataGridViewCellEventArgs e) { fila1 = e.RowIndex; BntGrabar.Visible = true; DataGridViewImageCell cell = DgvSocios.CurrentRow.Cells["photo"] as DataGridViewImageCell; imagen = (byte[])cell.Value; PicDetalle.Image = ClsFunc.byteArrayToImage(imagen); vUserId = Convert.ToInt32(DgvSocios.CurrentRow.Cells["Id"].Value); ObtenerHuellas(); }
private void AddCells() { ImageCell = new DataGridViewImageCell(false); ImageCell.ValueType = typeof(Image); SizeCell = new DataGridViewTextBoxCell(); SrCell = new DataGridViewTextBoxCell(); SharedCell = new DataGridViewTextBoxCell(); Cells.AddRange(new DataGridViewCell[] { ImageCell, SrCell, SizeCell, SharedCell }); UpdateDetails(); }
private void button_delete_Click(object sender, EventArgs e) { foreach (DataGridViewImageCell item in datagridview.SelectedCells) { DataGridViewImageCell cell = item as DataGridViewImageCell; cell.Value = Properties.Resources.help_32px1; if (unhiddenCells.Contains(item.RowIndex.ToString() + item.ColumnIndex.ToString())) { unhiddenCells.Remove(item.RowIndex.ToString() + item.ColumnIndex.ToString()); } } }
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { // Retrieve the image column for this row. DataGridViewImageCell col = (DataGridViewImageCell)dataGridView1.Rows[e.RowIndex].Cells["Image"]; // Set the image. col.Value = newImage; } }
public void Value() { DataGridViewImageCell tbc = new DataGridViewImageCell(); 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"); }
private void textBox7_TextChanged(object sender, EventArgs e) { (danhsachtonkhodgv.DataSource as DataTable).DefaultView.RowFilter = string.Format("TENVP LIKE '%{0}%' or TUKHOA LIKE '%{0}%' or MANHAPHANG like '%{0}%' ", textBox7.Text); foreach (DataGridViewRow row in danhsachtonkhodgv.Rows) { DataGridViewImageCell cell = row.Cells[0] as DataGridViewImageCell; string path = row.Cells[1].Value.ToString(); path = appPath + path; cell.Value = Bitmap.FromFile(path); row.Height = 100; } }
void FillDGV() { DataGridViewImageColumn imgC = new DataGridViewImageColumn(); DataGridViewImageColumn imgC2 = new DataGridViewImageColumn(); dataGridView1.Columns.AddRange(imgC, imgC2); for (int i = 0; i <= 1; i++) { DataGridViewTextBoxColumn dataGVTB = new DataGridViewTextBoxColumn(); dataGridView1.Columns.Add(dataGVTB); } dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("Century Gothic", 11, FontStyle.Bold); dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.Columns[2].HeaderText = "Код дисциплины"; dataGridView1.Columns[3].HeaderText = "Наименование дисциплины"; dataGridView1.Columns[2].Visible = false; dataGridView1.Columns[3].Width = 350; foreach (var el in subjectsList) { //el - studentList[i] //ячейки удалить и изменить DataGridViewRow dataGridViewRow = new DataGridViewRow(); dataGridViewRow.Height = 32; //creat button del or edit DataGridViewImageCell cc = new DataGridViewImageCell(); var idel = Image.FromFile(imgDelete); cc.Value = idel; dataGridViewRow.Cells.Add(cc); DataGridViewImageCell cc2 = new DataGridViewImageCell(); var iedit = Image.FromFile(imgEdit); cc2.Value = iedit; dataGridViewRow.Cells.Add(cc2); imgC.Width = 32; imgC2.Width = 32; var idS = el.IdSubject; DataGridViewCell c1 = new DataGridViewTextBoxCell(); c1.Value = idS; dataGridViewRow.Cells.Add(c1); var nSubj = el.NameSubject; DataGridViewCell c = new DataGridViewTextBoxCell(); c.Value = nSubj; dataGridViewRow.Cells.Add(c); dataGridView1.Rows.Add(dataGridViewRow); } }
protected void RefreshDataFromFile(VCFFile CardsFile) { List <string> tecolslist; string[] rowString; bool isThereData = false; int i; tecolslist = CardsFile.ColumnsList; for (i = 0; i < tecolslist.Count; i++) { if (_GetColumnPosAfterName(tecolslist[i]) == -1) { this.ColumnCount += 1; this.Columns[ColumnCount - 1].Name = tecolslist[i]; } } foreach (VCFCard teCard in CardsFile.CardList) { rowString = new string[this.ColumnCount]; isThereData = false; foreach (VCFElement teElement in teCard.ElementsList) { int teint = _GetColumnPosAfterName(teElement.Name); rowString[teint] = teElement.Value; isThereData = true; } if (isThereData) { this.Rows.Add(rowString); foreach (int col in _GetPhotoColumnList()) { for (i = 0; i < this.RowCount; i++) { if ((this.Rows[i].Cells[col].Value != null) && (Object.ReferenceEquals(this.Rows[i].Cells[col].Value.GetType(), "".GetType()))) { DataGridViewImageCell IC = new DataGridViewImageCell(); VCFPhoto tePhoto = new VCFPhoto(this.Rows[i].Cells[col].Value.ToString()); IC.Value = (Image)tePhoto.Img; this.Rows[i].Cells[col] = IC; this.Rows[i].Height = tePhoto.Img.Height; } } } } } this._NumerotateTable(); }
private void ShowClickedCashCounterProperties(DataGridViewImageCell cell) { CashCounter clickedCashCounter = cell.Tag as CashCounter; clickedElement = clickedCashCounter; MakePropertiesControls1Visible(); labelElementProperty1.Text = "Денег в кассе"; nudElementProperty1.Minimum = CashCounter.MinCashInRubles; nudElementProperty1.Maximum = CashCounter.MaxCashInRubles; nudElementProperty1.Value = clickedCashCounter.CashInRubles; }
private void ShowClickedFuelDispenserProperties(DataGridViewImageCell cell) { FuelDispenser clickedFuelDispenser = cell.Tag as FuelDispenser; clickedElement = clickedFuelDispenser; MakePropertiesControls1Visible(); labelElementProperty1.Text = "Скорость подачи"; nudElementProperty1.Minimum = FuelDispenser.MinFuelFeedRateInLitersPerMinute; nudElementProperty1.Maximum = FuelDispenser.MaxFuelFeedRateInLitersPerMinute; nudElementProperty1.Value = clickedFuelDispenser.FuelFeedRateInLitersPerMinute; }
private void setStatusColumn(DataGridViewRow row, int iStatus) { DataGridViewImageCell status = new DataGridViewImageCell(); List <object> estado = new Resources.Icons.status()[iStatus]; if (estado != null && estado.Count > 0) { status.Value = estado[0]; status.ToolTipText = (string)estado[1]; } row.Cells["_aprv"] = status; }
private void SetupCells() { _imageCell = new DataGridViewExImageCell(); _nameCell = new DataGridViewTextBoxCell(); _descriptionCell = new DataGridViewTextBoxCell(); _statusCell = new DataGridViewTextBoxCell(); Cells.Add(_imageCell); Cells.Add(_nameCell); Cells.Add(_descriptionCell); Cells.Add(_statusCell); this.UpdateDetails(); }
private void UpdateGridView(MoviesGridViewModel data) { int moviesRowHeight = 200; DataGridViewRow currentRow = null; var cells = new List <DataGridViewImageCell>(); foreach (DataGridViewRow row in dataGridView1.Rows) { ImagesHelper.DisposeImage((row.Cells[0] as DataGridViewImageCell).Value as Image); } dataGridView1.Rows.Clear(); data.Movies.ForEach(movie => { currentRow = new DataGridViewRow(); currentRow.Height = moviesRowHeight; currentRow.Tag = movie; var imageCell = new DataGridViewImageCell(); var nameCell = new DataGridViewTextBoxCell() { Value = movie.Name }; var yearCell = new DataGridViewTextBoxCell() { Value = movie.Year }; imageCell.ImageLayout = DataGridViewImageCellLayout.Zoom; cells.Add(imageCell); currentRow.Cells.Add(imageCell); currentRow.Cells.Add(nameCell); currentRow.Cells.Add(yearCell); dataGridView1.Rows.Add(currentRow); currentRow = null; }); if (currentRow != null) { dataGridView1.Rows.Add(currentRow); } for (int i = 0; i < cells.Count; i++) { var image = ImagesHelper.FromFile(data.Movies[i].Image); cells[i].Value = image; } }
private void ServiceListGamesCompleted(object sender, ListGamesCompletedEventArgs e) { if (e != null) { if ((e.Error != null) || (e.Result == null)) { MessageBox.Show(this, "Unable to contact the service. Please try again later.", "PSP Player"); return; } _gameList = e.Result; } Game[] games = _gameList; this.titleView.Rows.Clear(); foreach (Game game in games) { DataGridViewRow row = new DataGridViewRow(); row.Tag = game; { DataGridViewLinkCell cell = new DataGridViewLinkCell(); cell.Value = game.Title; row.Cells.Add(cell); } { DataGridViewLinkCell cell = new DataGridViewLinkCell(); if (game.Website != null) { cell.Value = "Visit Website"; } else { } row.Cells.Add(cell); } { DataGridViewImageCell cell = new DataGridViewImageCell(); cell.Value = _googleIcon; row.Cells.Add(cell); } this.titleView.Rows.Add(row); } this.titleView.Sort(this.TitleColumn, ListSortDirection.Ascending); _outstandingRefresh = false; }
private void button5_Click(object sender, EventArgs e) { Application.Restart(); for (i = 0; i < 15; i++) { for (j = 0; j < 15; j++) { DataGridViewImageCell res4 = new DataGridViewImageCell(); res4.Value = Properties.Resources.af; dataGridView1.Rows[i].Cells[j] = res4; if (i == 0) { DataGridViewImageCell res = new DataGridViewImageCell(); res.Value = Properties.Resources.la1; dataGridView1.Rows[i + 1].Cells[j] = res; } else if (j == 0) { DataGridViewImageCell res = new DataGridViewImageCell(); res.Value = Properties.Resources.la1; dataGridView1.Rows[i].Cells[j] = res; } else if (j == 14) { DataGridViewImageCell res = new DataGridViewImageCell(); res.Value = Properties.Resources.la1; dataGridView1.Rows[i].Cells[j] = res; } else if (i == 14) { DataGridViewImageCell res = new DataGridViewImageCell(); res.Value = Properties.Resources.la1; dataGridView1.Rows[i - 14].Cells[j] = res; } DataGridViewImageCell res1 = new DataGridViewImageCell(); res1.Value = Properties.Resources.la1; dataGridView1.Rows[0].Cells[0] = res1; DataGridViewImageCell res2 = new DataGridViewImageCell(); res2.Value = Properties.Resources.la1; dataGridView1.Rows[0].Cells[14] = res2; } mcount = 0; ccount = 0; } }
public VMRestoreRow(VM vm) { var iconCell = new DataGridViewImageCell { Value = Images.GetImage16For(vm) }; var nameCell = new DataGridViewTextBoxCell { Value = Helpers.GetName(vm) }; var locationCell = new DataGridViewTextBoxCell { Value = Helpers.GetName(vm.Connection.Resolve(vm.resident_on)) }; Cells.AddRange(iconCell, nameCell, locationCell); }
private void Loaded(object sender, AsyncCompletedEventArgs e) { try { PictureBox pb = (PictureBox)sender; int index = Convert.ToInt32(pb.Tag); DataGridViewImageCell img = (DataGridViewImageCell)_gridview.Rows[index].Cells[1]; img.Value = pb.Image; } catch { } }
private void DoAddMessage(string msg) { if (msg == null) { return; } lock (_messageAdder) { 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); } if (messageList.SelectedRows.Count > 0) { messageList.SelectedRows[0].Selected = false; } while (messageList.Rows.Count > 3000) { messageList.Rows.RemoveAt(0); } row.Height = 17; messageList.Rows.Add(row); row.Selected = true; messageList.FirstDisplayedScrollingRowIndex = messageList.Rows.Count - 1; } }
private DataGridViewColumn GetImageColumn(string columnName, int width = 100) { var cell = new DataGridViewImageCell(); cell.ImageLayout = DataGridViewImageCellLayout.Stretch; var column = new DataGridViewColumn(new DataGridViewImageCell()); column.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; column.Name = columnName; column.DataPropertyName = columnName; column.Width = width; return(column); }
private void DtgHerr_CellValueChanged(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex == 0) { DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)dtgHerr.Rows[e.RowIndex].Cells[0]; var checkedRows = from DataGridViewRow r in dtgHerr.Rows where Convert.ToBoolean(r.Cells[0].Value) == true select r; listHerr[e.RowIndex].sel = (bool)checkCell.Value; if (listHerr[e.RowIndex].imagen_name != null) { dtgHerr.Rows[e.RowIndex].Cells[4].Value = new Bitmap(Global.DIRECTORIO_IMAGENES + @"\" + Path.GetFileName(listHerr[e.RowIndex].imagen_name)); dtgHerr.SelectedRows[0].Height = 180; } lblSeleccionados.Text = checkedRows.ToList().Count.ToString(); dtgHerr.Invalidate(); } if (e.ColumnIndex == 2) { DataGridViewTextBoxCell Cell = (DataGridViewTextBoxCell)dtgHerr.Rows[e.RowIndex].Cells[2]; listHerr[e.RowIndex].herramienta = Cell.Value.ToString(); } if (e.ColumnIndex == 3) { DataGridViewTextBoxCell Cell = (DataGridViewTextBoxCell)dtgHerr.Rows[e.RowIndex].Cells[3]; listHerr[e.RowIndex].tipo = Cell.Value.ToString(); } if (e.ColumnIndex == 4) { DataGridViewImageCell Cell = (DataGridViewImageCell)dtgHerr.Rows[e.RowIndex].Cells[4]; listHerr[e.RowIndex].imagen = (Image)Cell.Value; } } catch (Exception ex) { Console.WriteLine("Ojo con el error: " + ex.ToString()); } }
private void AddCells() { ImageCell = new DataGridViewImageCell(false) { ValueType = typeof(Image) }; NameCell = new DataGridViewTextBoxCell(); SizeCell = new DataGridViewTextBoxCell(); SrCell = new DataGridViewTextBoxCell(); SharedCell = new DataGridViewTextBoxCell(); Cells.AddRange(ImageCell, NameCell, SrCell, SizeCell, SharedCell); UpdateDetails(); }
private void _schedulesDataGridView_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { foreach (DataGridViewRow row in _schedulesDataGridView.Rows) { Icon icon = Properties.Resources.TransparentIcon; ScheduleSummary schedule = row.DataBoundItem as ScheduleSummary; if (schedule != null) { icon = ProgramIconUtility.GetIcon(_scheduleType, !schedule.IsOneTime); } DataGridViewImageCell cell = (DataGridViewImageCell)row.Cells[1]; cell.Value = icon; cell.ValueIsIcon = true; } }
public void SetNotDuplicateDisplay(DataGridViewImageCell cell) { cell.Style.BackColor = Color.White; cell.DataGridView.InvalidateCell(cell); cell.ImageLayout = DataGridViewImageCellLayout.Normal; var data = GetActiveCellData(cell); if (data != null) { cell.Value = _imageService.GetThumb(data.ImagePath, _configService.ThumbMaxHeight); } cell.DataGridView.InvalidateCell(cell); }
private void openFileDialog1_FileOk_1(object sender, CancelEventArgs e) { DataGridViewRow row = new DataGridViewRow(); DataGridViewTextBoxCell FileName = new DataGridViewTextBoxCell(); FileName.Value = attachmentsFileDialog.FileName.Split(new char[] { '\\' }).Last(); FileName.Tag = attachmentsFileDialog.FileName; row.Cells.Add(FileName); DataGridViewImageCell image = new DataGridViewImageCell(); image.Value = TravelAgency.Properties.Resources.remove16; row.Cells.Add(image); dgvAttachments.Rows.Add(row); //dgvAttachments.Height += row.Height; }
public DataGridViewRow GetWarningRow() { DataGridViewRow row = new DataGridViewRow(); DataGridViewImageCell warningImageCell = new DataGridViewImageCell(); warningImageCell.Value = Images.StaticImages._000_Alert2_h32bit_16; DataGridViewTextBoxCell warningCell = new DataGridViewTextBoxCell(); warningCell.Value = string.Format("{0}\n\r\n\r{1}", ActionTitle, WarningMessage); row.Cells.Add(warningImageCell); row.Cells.Add(warningCell); return(row); }
private void dgvField_DragDrop(object sender, DragEventArgs e) { try { Point cursorPosition = dgvField.PointToClient(Cursor.Position); DataGridView.HitTestInfo hitTestInfo = dgvField.HitTest(cursorPosition.X, cursorPosition.Y); DataGridViewImageCell cell = (DataGridViewImageCell)dgvField[hitTestInfo.ColumnIndex, hitTestInfo.RowIndex]; AddElement(cell); } catch (ArgumentOutOfRangeException) { return; } }
public baseGridViewImageColumn(DataGridViewImageCell obj) : base(obj) { }