本文整理汇总了C#中System.Windows.Forms.DataGridViewImageColumn类的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewImageColumn类的具体用法?C# DataGridViewImageColumn怎么用?C# DataGridViewImageColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGridViewImageColumn类属于System.Windows.Forms命名空间,在下文中一共展示了DataGridViewImageColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadTutorial
private void LoadTutorial()
{
tutorialGridView.Rows.Clear();
tutorialGridView.Columns.Clear();
string[] imagePaths = Directory.GetFiles(GestureStudio.GestureImagePath);
for (int i = 0; i < imagePaths.Length / 3; i++)
{
DataGridViewImageColumn ImageColumn = new System.Windows.Forms.DataGridViewImageColumn() { HeaderText = "Gesture" };
DataGridViewTextBoxColumn TextColumn = new System.Windows.Forms.DataGridViewTextBoxColumn() { HeaderText = "Name" };
tutorialGridView.Columns.Add(ImageColumn);
tutorialGridView.Columns.Add(TextColumn);
}
for (int i = 0; i < imagePaths.Length / 3; i++)
{
// Read in three images. Add to row.
FileStream fs1 = File.OpenRead(imagePaths[i * 3]);
byte[] by1 = new byte[fs1.Length];
fs1.Read(by1, 0, by1.Length);
String name1 = System.IO.Path.GetFileNameWithoutExtension(imagePaths[i * 3]);
FileStream fs2 = File.OpenRead(imagePaths[i * 3 + 1]);
byte[] by2 = new byte[fs2.Length];
fs2.Read(by2, 0, by2.Length);
String name2 = System.IO.Path.GetFileNameWithoutExtension(imagePaths[i * 3 + 1]);
FileStream fs3 = File.OpenRead(imagePaths[i * 3 + 2]);
byte[] by3 = new byte[fs3.Length];
fs3.Read(by3, 0, by3.Length);
String name3 = System.IO.Path.GetFileNameWithoutExtension(imagePaths[i * 3 + 2]);
tutorialGridView.Rows.Add(by1, name1, by2, name2, by3, name3);
}
}
示例2: datagird_style
public void datagird_style()
{
try
{
theater_search.Columns[0].HeaderText = "Theater Name";
theater_search.Columns[1].HeaderText = "Screen Name";
theater_search.Columns[2].HeaderText = "Location";
theater_search.Columns[3].HeaderText = "City";
theater_search.Columns[4].HeaderText = "Status";
if (!theater_search.Columns.Contains("edit"))
{
DataGridViewImageColumn edit = new DataGridViewImageColumn();
DataGridViewImageColumn delete = new DataGridViewImageColumn();
Image image = Image.FromFile(@"E:\Current Working\E-booking\Eticket_picx\delete.PNG");
Image image1 = Image.FromFile(@"E:\Current Working\E-booking\Eticket_picx\edit.PNG");
delete.Image = image;
edit.Image = image1;
//button.DefaultCellStyle
theater_search.Columns.Add(edit);
theater_search.Columns.Add(delete);
theater_search.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
theater_search.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
theater_search.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
theater_search.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
theater_search.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
theater_search.Columns[theater_search.Columns.Count-2].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
theater_search.Columns[theater_search.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
}
}
catch { }
}
示例3: frmArqueoCaja
public frmArqueoCaja(DateTimePicker dtPicker)
{
InitializeComponent();
Cursor.Current = Cursors.WaitCursor;
this.dtPicker = dtPicker;
DataGridViewImageColumn imageColumn2 = new DataGridViewImageColumn();
Image image2 = global::StockVentas.Properties.Resources.document_edit;
imageColumn2.Image = image2;
imageColumn2.Name = "Editar";
dgvTesoreria.Columns.Add(imageColumn2);
DataGridViewImageColumn imageColumn = new DataGridViewImageColumn();
Image image = global::StockVentas.Properties.Resources.delete16;
imageColumn.Image = image;
imageColumn.Name = "Borrar";
dgvTesoreria.Columns.Add(imageColumn);
dgvTesoreria.CellClick += new DataGridViewCellEventHandler(dgvTesoreria_CellClick);
DataGridViewImageColumn imageColumn3 = new DataGridViewImageColumn();
imageColumn3.Image = image2;
imageColumn3.Name = "Editar";
dgvVentas.Columns.Add(imageColumn3);
DataGridViewImageColumn imageColumn4 = new DataGridViewImageColumn();
imageColumn4.Image = image;
imageColumn4.Name = "Borrar";
dgvVentas.Columns.Add(imageColumn4);
dgvVentas.CellClick += new DataGridViewCellEventHandler(dgvVentas_CellClick);
tblArticulos = BL.ArticulosBLL.CrearDataset();
}
示例4: frmArqueoCajaAdmin
public frmArqueoCajaAdmin(DataSet dsArqueo, DateTime fecha, int idLocal, string nombreLocal, int idPc)
{
InitializeComponent();
frmInstanciaArqueo = this;
this.dt = dsArqueo;
this.fecha = fecha;
this.idLocal = idLocal;
this.nombreLocal = nombreLocal;
this.idPc = idPc;
Cursor.Current = Cursors.WaitCursor;
DataGridViewImageColumn imageColumn2 = new DataGridViewImageColumn();
Image image2 = global::StockVentas.Properties.Resources.document_edit;
imageColumn2.Image = image2;
imageColumn2.Name = "Editar";
dgvTesoreria.Columns.Add(imageColumn2);
DataGridViewImageColumn imageColumn = new DataGridViewImageColumn();
Image image = global::StockVentas.Properties.Resources.delete16;
imageColumn.Image = image;
imageColumn.Name = "Borrar";
dgvTesoreria.Columns.Add(imageColumn);
dgvTesoreria.CellClick += new DataGridViewCellEventHandler(dgvTesoreria_CellClick);
DataGridViewImageColumn imageColumn3 = new DataGridViewImageColumn();
imageColumn3.Image = image2;
imageColumn3.Name = "Editar";
dgvVentas.Columns.Add(imageColumn3);
DataGridViewImageColumn imageColumn4 = new DataGridViewImageColumn();
imageColumn4.Image = image;
imageColumn4.Name = "Borrar";
dgvVentas.Columns.Add(imageColumn4);
dgvVentas.CellClick += new DataGridViewCellEventHandler(dgvVentas_CellClick);
tblArticulos = BL.GetDataBLL.Articulos();
OrganizarTablas();
CargarDatos();
}
示例5: Grille
public Grille()
{
InitializeComponent();
this.grilleData.AutoGenerateColumns = false; //Les colonnes sont créées manuellement
grilleData.Columns.Insert(0, this.createSimpleColumn("Ref"));
grilleData.Columns.Insert(1, this.createSimpleColumn("Contexte"));
grilleData.Columns.Insert(2, this.createSimpleColumn("Sujet"));
grilleData.Columns.Insert(3, this.createSimpleColumn("Titre"));
grilleData.Columns["Titre"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
// Création de la colonne des liens
DataGridViewImageColumn linkCol = new DataGridViewImageColumn();
linkCol.Name = "Liens";
linkCol.DataPropertyName = "Liens";
grilleData.Columns.Insert(4, linkCol);
grilleData.Columns.Insert(5, this.createSimpleColumn("Deadline"));
grilleData.Columns.Insert(6, this.createSimpleColumn("Destinataire"));
grilleData.Columns.Insert(7, this.createSimpleColumn("Statut"));
this.grilleData.DataSource = new DataTable();
// On rajoute les lignes qu'il faut dans le contextMenu de la liste d'actions
NameValueCollection section = (NameValueCollection)ConfigurationManager.GetSection("Export");
// Affichage de l'item dans le menu uniquement si une valeur d'export
this.exportMenuItem.Visible = (section.Count > 0);
foreach (string key in section)
this.exportMenuItem.DropDown.Items.Add(key, null, this.exportRow);
((ToolStripDropDownMenu)exportMenuItem.DropDown).ShowImageMargin = false;
}
示例6: UnboundImage_Load
private void UnboundImage_Load(object sender, EventArgs e)
{
genericImage = imageList.Images[1];
newImage = imageList.Images[0];
// Bind the grid.
dataGridView1.DataSource = Program.StoreDB.GetProducts();
// Create the image column.
DataGridViewImageColumn imageCol = new DataGridViewImageColumn();
imageCol.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
imageCol.ImageLayout = DataGridViewImageCellLayout.Normal;
imageCol.Frozen = true;
imageCol.Name = "Image";
imageCol.HeaderText = "";
// Move the column to the left, and move the ProductID
// column out of the way.
imageCol.DisplayIndex = 0;
dataGridView1.Columns["ProductID"].DisplayIndex = 1;
// By default, show the generic image.
imageCol.Image = genericImage;
// Add the image column to the grid.
dataGridView1.Columns.Add(imageCol);
}
示例7: adviserForm_Load
//onload fill datagrid
private void adviserForm_Load(object sender, EventArgs e)
{
DataGridViewColumn column = new DataGridViewTextBoxColumn();
// Initialize and add a check box column.
column = new DataGridViewImageColumn();
// column.Image
column.DataPropertyName = "pictureArrByte";
column.Width = 80;
column.Name = "picture";
column.ReadOnly = false;
dataGridView.Columns.Add(column);
column = new DataGridViewTextBoxColumn();
column.DataPropertyName = "playerId";
column.Name = "Id";
dataGridView.Columns.Add(column);
column = new DataGridViewTextBoxColumn();
column.DataPropertyName = "firstName";
column.Name = "First Name";
dataGridView.Columns.Add(column);
column = new DataGridViewTextBoxColumn();
column.DataPropertyName = "lastName";
column.Name = "Last Name";
dataGridView.Columns.Add(column);
// Initialize and add a check box column.
DataGridViewCheckBoxColumn columnCheckBox = new DataGridViewCheckBoxColumn();
columnCheckBox.DataPropertyName = "Action";
columnCheckBox.Name = "Action";
columnCheckBox.ReadOnly = false;
dataGridView.Columns.Add(columnCheckBox);
//Fill data to form
Players[] list = server.getAdvisors(playerId);
dataGridView.AutoGenerateColumns = false;
dataGridView.AutoSize = false;
foreach (Players player in list)
{
if (player.pictureArrByte != null)
{
Rectangle compressionRectangle = new Rectangle(60, 60,
player.pictureArrByte.Width / 2, player.pictureArrByte.Height / 2);
using (Graphics g = Graphics.FromImage(player.pictureArrByte))
g.DrawImage(player.pictureArrByte, compressionRectangle);
}
}
dataGridView.DataSource = list;
//set the heigt for picture colum
foreach (DataGridViewRow row in dataGridView.Rows)
{
row.Height = 75;
}
}
示例8: FormFtpClient
public FormFtpClient()
{
InitializeComponent();
// title bar
this.Text = Application.ProductName + " " + Application.ProductVersion;
// setup grid
DataGridViewImageColumn ic = new DataGridViewImageColumn( false );
ic.Name = "Type";
gridItems.Columns.Add( ic );
gridItems.Columns.Add( "Name", "Name" );
gridItems.Columns.Add( "Size", "Size" );
gridItems.Columns.Add( "Date", "Date" );
gridItems.Columns["Type"].Width = 34;
gridItems.Columns["Name"].Width = 200;
gridItems.Columns["Size"].Width = 100;
gridItems.Columns["Size"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
gridItems.Columns["Date"].Width = 120;
// update
UpdateUi();
}
示例9: AddMeasure
public AddMeasure()
{
InitializeComponent();
string dbPath = Path.Combine(
Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location),
Properties.Settings.Default.DbName);
this.engine = new SQLiteDBEngine(dbPath);
// Облачность
cbCloud.DataSource = engine.AddBlankRow(engine.ExecuteQueryReturnDataTable(new SQLiteCommand("SELECT ID, Name FROM cloud")));
cbCloud.DisplayMember = "Name";
cbCloud.ValueMember = "ID";
// Ветер
cbWind.DataSource = engine.AddBlankRow(engine.ExecuteQueryReturnDataTable(new SQLiteCommand("SELECT ID, Name FROM wind")));
cbWind.DisplayMember = "Name";
cbWind.ValueMember = "ID";
// Сила ветра
cbWindForce.DataSource = engine.AddBlankRow(engine.ExecuteQueryReturnDataTable(new SQLiteCommand("SELECT ID, Name FROM windForce")));
cbWindForce.DisplayMember = "Name";
cbWindForce.ValueMember = "ID";
// Осадки
cbFallouts.DataSource = engine.ExecuteQueryReturnDataTable(new SQLiteCommand("SELECT ID, Name, IconPath FROM fallout"));
cbFallouts.DisplayMember = "Name";
cbFallouts.ValueMember = "ID";
cbFallouts.DropDownStyle = ComboBoxStyle.DropDownList;
btnAddFallout.Click += btnAddFallout_Click;
btnDelFallout.Click += btnDelFallout_Click;
// Осадки
dgvFallouts.ReadOnly = true;
dgvFallouts.RowHeadersVisible = false;
dgvFallouts.ColumnHeadersVisible = false;
dgvFallouts.AutoGenerateColumns = false;
dgvFallouts.AllowUserToAddRows = false;
dgvFallouts.CellBorderStyle = DataGridViewCellBorderStyle.None;
dgvFallouts.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvFallouts.RowTemplate.Height = 36;
// Precipitation table
var flColumn = new DataGridViewTextBoxColumn();
flColumn.DataPropertyName = "Name";
flColumn.Name = "Name";
flColumn.HeaderText = "Имя";
flColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dgvFallouts.Columns.Add(flColumn);
var flIconColumn = new DataGridViewImageColumn();
flIconColumn.DataPropertyName = "FalloutIcon";
flIconColumn.Name = "FalloutIcon";
flIconColumn.HeaderText = "Иконка";
flIconColumn.Width = 36;
dgvFallouts.Columns.Add(flIconColumn);
errorProvider = new ErrorProvider();
tbTemperature.Validating += new CancelEventHandler(tbTemperature_Validating);
dgvFallouts.DataSource = this.engine.ExecuteQueryReturnDataTable(new SQLiteCommand("SELECT fs.ID, fs.Measure_ID, fs.Fallout_ID, f.Name, f.IconPath, NULL AS FalloutIcon FROM fallouts fs INNER JOIN fallout f ON fs.Fallout_ID = f.ID WHERE fs.Measure_ID IS NULL"));
dgvFallouts.RowsAdded += new DataGridViewRowsAddedEventHandler(dgvFallouts_RowsAdded);
}
示例10: configForm
private void configForm()
{
this.Text = Constantes.APP_NAME + " : Historique Approvisionnement";
DataGridViewImageColumn iconColumn = new DataGridViewImageColumn();
iconColumn.Name = "mouv";
iconColumn.HeaderText = "";
dgv_approvision.Columns.Insert(3, iconColumn);
}
示例11: AddColumnsProgrammatically
private void AddColumnsProgrammatically()
{
var col0 = new DataGridViewTextBoxColumn();
var col1 = new DataGridViewTextBoxColumn();
var col1a = new DataGridViewTextBoxColumn();
var col2 = new DataGridViewTextBoxColumn();
var col2a = new DataGridViewTextBoxColumn();
var col3 = new DataGridViewTextBoxColumn();
var col4 = new DataGridViewTextBoxColumn();
col0.HeaderText = "Id";
col0.Name = "Id";
col0.ReadOnly = true;
col0.Visible = false;
col1.HeaderText = "User";
col1.Name = "User_Id";
col1.ReadOnly = true;
col1.Visible = false;
col1a.HeaderText = "Name";
col1a.Name = "Name";
col1a.ReadOnly = true;
col2.HeaderText = "Message";
col2.Name = "Message";
//col2.Width = 300;
col2.ReadOnly = true;
col2a.HeaderText = "Countdown";
col2a.Name = "countdown_ind";
col2a.ReadOnly = true;
col2a.Visible = false;
col3.HeaderText = "End Date";
col3.Name = "End_Date";
col3.ReadOnly = true;
col4.HeaderText = "Repeat";
col4.Name = "Repeat_Ind";
col4.ReadOnly = true;
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { col0, col1, col1a, col2, col2a, col3, col4 });
DataGridViewImageColumn img_delete = new DataGridViewImageColumn();
dataGridView1.Columns.Add(img_delete);
img_delete.HeaderText = "Delete";
img_delete.Name = "Delete";
img_delete.Image = FruPak.PF.Global.Properties.Resources.delete;
img_delete.ReadOnly = true;
DataGridViewImageColumn img_edit = new DataGridViewImageColumn();
dataGridView1.Columns.Add(img_edit);
img_edit.HeaderText = "Edit";
img_edit.Name = "Edit";
img_edit.Image = FruPak.PF.Global.Properties.Resources.edit;
img_edit.ReadOnly = true;
}
示例12: JpegViewer
public JpegViewer(string[] _jpgFiles, string jpgFile = "")
{
InitializeComponent();
this.WindowState = FormWindowState.Maximized;//Maximize form
#region initialize dgv
//Add ImageColumn
DataGridViewImageColumn imgColumn = new DataGridViewImageColumn();
imgColumn.Name = "Image";
imgColumn.ImageLayout = DataGridViewImageCellLayout.Zoom;//イメージを縦横の比率を維持して拡大、縮小表示する
imgColumn.Description = "イメージ"; //イメージの説明。セルをクリップボードにコピーした時に使用される
dgv.Columns.Add(imgColumn);//DataGridViewに追加する
dgv.Columns["Image"].Width = 120;
dgv.RowTemplate.Height = 90;
//Add CheckBoxColumn
DataGridViewCheckBoxColumn cbColumn = new DataGridViewCheckBoxColumn();
cbColumn.Name = "cbColumn";
dgv.Columns.Add(cbColumn);
cbColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
//Add TextBoxColumn
DataGridViewTextBoxColumn tbColumn = new DataGridViewTextBoxColumn();
tbColumn.Name = "tbColumn";
tbColumn.ReadOnly = true;
dgv.Columns.Add(tbColumn);
tbColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
dgv.RowHeadersVisible = false;//Make selector invisible
dgv.ColumnHeadersVisible = false;//Make column header invisible
dgv.AllowUserToAddRows = false;
dgv.AllowUserToResizeColumns = false;
dgv.AllowUserToResizeRows = false;
#endregion
#region dgv image procedure
jpgFiles.AddRange(_jpgFiles);
jpgFiles.Sort();
for (int i = 0; i < jpgFiles.Count; i++)
{
try
{
dgv.Rows.Add();
dgv["Image", i].Value = new Bitmap(jpgFiles[i].ToString());
}
catch (ArgumentOutOfRangeException)
{ MessageBox.Show("[ArgumentOutOfRangeException]" + Properties.Resources.HasOccurred, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
}
#endregion
#region pictureBox
pbMain.SizeMode = PictureBoxSizeMode.Zoom;
selectedJpgFile = jpgFile;
#endregion
}
示例13: ImageTest
public void ImageTest ()
{
SWF.DataGridViewImageColumn column = new SWF.DataGridViewImageColumn ();
column.HeaderText = "Image Column";
ColumnCellTest (column,
new SWF.DataGridViewImageCell (),
false,
new SWF.DataGridViewImageCell ());
}
示例14: frmEmpleadosMovCons
public frmEmpleadosMovCons(DataTable tblEmpleadosMov)
{
InitializeComponent();
this.tblEmpleadosMov = tblEmpleadosMov;
DataGridViewImageColumn imageColumn2 = new DataGridViewImageColumn();
Image image2 = global::StockVentas.Properties.Resources.document_edit;
imageColumn2.Image = image2;
imageColumn2.Name = "Editar";
dgvEmpleados.Columns.Add(imageColumn2);
}
示例15: createDgvImageColumn
public static DataGridViewImageColumn createDgvImageColumn(String dataPropertyName, String headerText, int width, bool visible)
{
DataGridViewImageColumn column = new DataGridViewImageColumn();
column.DataPropertyName = dataPropertyName;
column.HeaderText = headerText;
column.Width = width;
column.ImageLayout = DataGridViewImageCellLayout.Normal;
column.Visible = visible;
return column;
}