本文整理汇总了C#中System.Windows.Forms.DataGridViewRow.CreateCells方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewRow.CreateCells方法的具体用法?C# DataGridViewRow.CreateCells怎么用?C# DataGridViewRow.CreateCells使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridViewRow
的用法示例。
在下文中一共展示了DataGridViewRow.CreateCells方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoQuery
public void DoQuery()
{
AddSelect(ActiveQuery);
if (Root == null)
{
MessageBox.Show("Please select a node to start the query at");
return;
}
if (ActiveQuery == null || ActiveQuery == "")
{
MessageBox.Show("Please enter a query string");
return;
}
List<IAttribute> results = new List<IAttribute>(5);
Root.SimpleQuery(ActiveQuery, results, true);
//{
// MessageBox.Show("Query failed\nPartial results displayed");
//}
dataGridView1.Rows.Clear();
DataGridViewRow row;
foreach (IAttribute entry in results)
{
row = new DataGridViewRow();
row.CreateCells(dataGridView1, entry.Parent.Label, entry.Label, entry.Value);
row.Tag = entry;
Grid.Rows.Add(row);
}
}
示例2: FormSenka_Load
private void FormSenka_Load(object _sender, EventArgs _e)
{
RecordManager.Instance.Senka.OnUpdated += UpdatedRanking;
APIObserver.Instance.APIList["api_port/port"].ResponseReceived +=
(_, __) => {
UpdatedMySenka();
UpdatedRanking();
};
// フォント設定変更時反映イベント
Utility.Configuration.Instance.ConfigurationChanged += ConfigurationChanged;
// 各順位の行を作成
SenkaView.SuspendLayout();
SenkaView.Rows.Clear();
int[] ranks = { 1, 5, 20, 100, 500 };
for(int i = 0; i < RankRows.Length; i++)
{
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(SenkaView);
row.Cells[SenkaView_Rank.Index].Value = $"{ranks[i]}位";
SenkaView.Rows.Add(row);
RankRows[i] = row;
}
ConfigurationChanged();
SenkaView.ResumeLayout();
}
示例3: addHeaderBtn_Click
private void addHeaderBtn_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(reqHeaderKeyCmb.Text))
{ return; }
if (string.IsNullOrEmpty(reqHeaderValTxt.Text))
{ return; }
foreach (DataGridViewRow r in headerGrdVw.Rows)
{
if (r.Cells[0].Value != null &&
r.Cells[0].Value.ToString() == reqHeaderKeyCmb.Text)
{
MessageBox.Show("該Header已存在!");
return;
}
}
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(headerGrdVw);
row.Cells[0].Value = reqHeaderKeyCmb.Text;
row.Cells[1].Value = reqHeaderValTxt.Text;
headerGrdVw.Rows.Add(row);
reqHeaderKeyCmb.SelectedIndex = 0;
reqHeaderValTxt.Text = string.Empty;
}
示例4: OnPrimaryKeyChangedComplete
protected override void OnPrimaryKeyChangedComplete(Exception error)
{
if (error != null)
{
RTOut.WriteError(error);
throw error;
}
dgvUDS.Rows.Clear();
List<string> udsNames = new List<string>();
foreach (XElement each in UDS.Elements("Contract"))
{
udsNames.Add(each.AttributeText("Name"));
}
udsNames.Sort();
foreach (string each in udsNames)
{
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(dgvUDS, each);
dgvUDS.Rows.Add(row);
}
}
示例5: btnFile_Click
private void btnFile_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
ofd.Filter = "Delta files|*.*";
ofd.Multiselect = false;
ofd.CheckFileExists = true;
ofd.AddExtension = true;
if (ofd.ShowDialog() == DialogResult.OK)
{
DeltaHeaderInfo dhi = DeltaAPI.GetDeltaInformation(ofd.FileName);
gvInformation.Rows.Clear();
Type typeData = typeof(DeltaHeaderInfo);
foreach(var field in typeData.GetFields())
{
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(gvInformation);
row.Cells[0].Value = field.Name;
row.Cells[1].Value = field.GetValue(dhi).ToString();
gvInformation.Rows.Add(row);
}
}
}
}
示例6: AddRows
private void AddRows(IEnumerable<string> rows)
{
_exampleRow = rows.First();
var rowArray = rows.Select(row =>
{
var model = RowViewModel.Parse(_settings, row);
var dgrow = new DataGridViewRow();
dgrow.CreateCells(gridView, model.Data);
dgrow.DefaultCellStyle.BackColor = model.Color;
dgrow.Visible = !model.Hidden;
return dgrow;
}).ToArray();
gridView.Rows.AddRange(rowArray);
if (!toolStripButtonScrollLock.Checked) return;
for (int index = gridView.Rows.Count - 1; index > 0; index--)
{
var dataGridViewRow = gridView.Rows[index];
if (dataGridViewRow.Visible)
{
gridView.FirstDisplayedScrollingRowIndex = index;
return;
}
}
}
示例7: DialogShipGroupColumnFilter
public DialogShipGroupColumnFilter( DataGridView target, ShipGroupData group ) {
InitializeComponent();
var rows = new LinkedList<DataGridViewRow>();
var row = new DataGridViewRow();
row.CreateCells( ColumnView );
row.SetValues( "(全て)", null, null, "-" );
row.Cells[ColumnView_Width.Index].ReadOnly = true;
rows.AddLast( row );
foreach ( var c in group.ViewColumns.Values.OrderBy( c => c.DisplayIndex ) ) {
row = new DataGridViewRow();
row.CreateCells( ColumnView );
row.SetValues( target.Columns[c.Name].HeaderText, c.Visible, c.AutoSize, c.Width );
row.Cells[ColumnView_Width.Index].ValueType = typeof( int );
row.Tag = c.Name;
rows.AddLast( row );
}
ColumnView.Rows.AddRange( rows.ToArray() );
ScrLkColumnCount.Minimum = 0;
ScrLkColumnCount.Maximum = group.ViewColumns.Count;
ScrLkColumnCount.Value = group.ScrollLockColumnCount;
}
示例8: lbChannels_Click
private void lbChannels_Click(object sender, EventArgs e)
{
if (lbChannels.SelectedIndex == -1)
return;
grid.Rows.Clear();
string id = lbChannels.SelectedItem.ToString();
id = id.Substring(0, id.IndexOf(" "));
List<EPGInfo> infos = server.GetEPGForChannel(id);
bool isAlternating = false;
foreach (EPGInfo epg in infos)
{
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(grid);
row.Cells[0].Value = epg.startTime.ToString("dd.MM.yy") + " " + epg.startTime.ToString("HH:mm") + "-" +
epg.endTime.ToString("HH:mm");
row.Cells[1].Value = epg.title;
row.DefaultCellStyle.Font = new Font("Tahoma", 8, FontStyle.Bold);
if (isAlternating)
row.DefaultCellStyle.BackColor = System.Drawing.Color.LightGray;
grid.Rows.Add(row);
row = new DataGridViewRow();
row.CreateCells(grid);
row.Cells[1].Value = epg.description;
if (isAlternating)
row.DefaultCellStyle.BackColor = System.Drawing.Color.LightGray;
grid.Rows.Add(row);
isAlternating = (!isAlternating);
}
grid.AutoResizeColumns();
}
示例9: bufferingLog
/// <summary>
/// 取得したログをGrid、Chartに出力する
/// </summary>
/// <param name="logData"></param>
private void bufferingLog(LogData logData)
{
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(dataGridView);
row.Cells[0].Value = logData.RelTick;
row.Cells[1].Value = logData.DataLeft;
row.Cells[2].Value = logData.DataRight;
row.Cells[3].Value = logData.Light;
row.Cells[4].Value = logData.MotorCnt0;
row.Cells[5].Value = logData.MotorCnt1;
row.Cells[6].Value = logData.MotorCnt2;
row.Cells[7].Value = logData.SensorAdc0;
row.Cells[8].Value = logData.SensorAdc1;
row.Cells[9].Value = logData.SensorAdc2;
row.Cells[10].Value = logData.SensorAdc3;
row.Cells[11].Value = logData.I2c;
logBufferList.Add(row);
if (stopwatch4Grid.ElapsedMilliseconds > 1000 || logBufferList.Count > 100)
{
outputGrid();
stopwatch4Grid.Restart();
logBufferList.Clear();
}
}
示例10: getDataGridViewRow
public DataGridViewRow getDataGridViewRow(DataGridView dg, KeeperTracker mt)
{
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(dg);
string dgIdentifier = this.ident.ToString("X").PadLeft(8, '0') + "h";
string dgRemoteRequest = (this.remote_request?"Yes":"No");
string dgLength = this.data_length.ToString();
string dgData = byteArrayToHexString(this.data, this.data_length);
string dgPeriod = mt.getPeriod(this).ToString();
string dgCount = mt.getCount(this).ToString();
string dgTime = mt.getTime(this).ToLongTimeString();
ArrayList a = new ArrayList();
a.Add(dgIdentifier);
a.Add(dgRemoteRequest);
a.Add(dgLength);
a.Add(dgData);
a.Add(dgPeriod);
a.Add(dgCount);
a.Add(dgTime);
a.Add(this.ident);
a.Add(this);
row.SetValues(a.ToArray());
return row;
}
示例11: AddValidRow
private void AddValidRow(DataGridViewRow dr, Dictionary<string, string> results)
{
if (results.Count == 0) return;
// Prepare the new row
DataGridViewRow dgvr = new DataGridViewRow();
dgvr.CreateCells(gridViewResults);
DataGridViewCellStyle style = new DataGridViewCellStyle();
style.BackColor = Color.LightGreen;
style.ForeColor = Color.Black;
dgvr.Cells[3].Style = style;
// Based on the Crawling Settings, add the new data to the result grid view
switch (cs.CrawlItemType)
{
case "Social Media":
dgvr.SetValues(new object[] {count, dr.Cells[1].Value, dr.Cells[2].Value, "Valid", results["facebook"], results["linkedin"], results["twitter"], results["youtube"] });
SaveToDB(count, dr.Cells[1].Value, dr.Cells[2].Value, "Valid", results["facebook"], results["linkedin"], results["twitter"], results["youtube"]);
break;
case "Contact Info":
dgvr.SetValues(new object[] {count, dr.Cells[1].Value, dr.Cells[2].Value, "Valid", results["email"], results["phone"], results["fax"] });
break;
}
gridViewResults.Rows.Add(dgvr);
}
示例12: btnUpdate_Click
private void btnUpdate_Click(object sender, EventArgs e)
{
DataGridViewRow newrow = new DataGridViewRow();
newrow.CreateCells(dataGridView1);
newrow.Cells[0].Value = eventstat.NrOfReg() +" Users";
newrow.Cells[1].Value = eventstat.TickWithDiscount() * 45 + eventstat.TickWithoutDiscount() * 50 + " €";
newrow.Cells[2].Value = eventstat.NrOfCampRented() + " rented camps";
newrow.Cells[3].Value = eventstat.CampRev() + " €";
newrow.Cells[4].Value = eventstat.FoodRev() + " €";
newrow.Cells[5].Value = eventstat.LoanMatRev() + " €";
newrow.Cells[6].Value = eventstat.TickWithDiscount() * 45 + eventstat.TickWithoutDiscount() * 50 + eventstat.CampRev() + eventstat.FoodRev() + eventstat.LoanMatRev() + " €";
dataGridView1.Rows.Add(newrow);
textBox2.Text = eventstat.NrOfReg().ToString(); textBox2.BackColor = Color.GreenYellow;// visitors expected
textBox7.Text = Convert.ToString(eventstat.NrOfVisPresent()); textBox7.BackColor = Color.GreenYellow;// visitors presents
textBox6.Text = (eventstat.NrOfReg() - eventstat.NrOfVisPresent()).ToString(); textBox6.BackColor = Color.GreenYellow;// visitors left
textBox3.Text = eventstat.EvAccountBalance().ToString() + " €"; textBox3.BackColor = Color.GreenYellow;// event account balance
textBox5.Text = Convert.ToString(150 - eventstat.NrOfCampRented()); textBox5.BackColor = Color.GreenYellow;// Number of free camping spots
//textBox12.Text = eventstat.BBurgerSold().ToString(); textBox12.BackColor = Color.GreenYellow;// big burger sold
//textBox11.Text = eventstat.CColaSold().ToString(); textBox11.BackColor = Color.GreenYellow;// coca cola sold
//textBox9.Text = eventstat.ChickBurgerSold().ToString(); textBox9.BackColor = Color.GreenYellow;// chicken burger sold
//textBox13.Text = eventstat.FFriesSold().ToString(); textBox13.BackColor = Color.GreenYellow;// french fries sold
//textBox14.Text = eventstat.HBeerSold().ToString(); textBox14.BackColor = Color.GreenYellow;// Heinneken beer sold
//textBox15.Text = eventstat.SaladSold().ToString(); textBox15.BackColor = Color.GreenYellow;// Salad sold
}
示例13: OnPrimaryKeyChangedComplete
protected override void OnPrimaryKeyChangedComplete(Exception error)
{
if (error != null)
{
RTOut.WriteError(error);
throw error;
}
dgvUDT.Rows.Clear();
List<string> udtNames = new List<string>();
foreach (XElement each in UDT.Elements("TableName"))
udtNames.Add(each.Value);
udtNames.Sort();
foreach (string each in udtNames)
{
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(dgvUDT, each);
dgvUDT.Rows.Add(row);
}
}
示例14: TableForm
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);
}
示例15: OnPrimaryKeyChangedComplete
protected override void OnPrimaryKeyChangedComplete(Exception error)
{
dgvTransfers.Rows.Clear();
if (error == null)
{
Dictionary<int, string> indexToFIeldName = GetIndexMapping(Data);
foreach (XElement record in Data.Elements("Record"))
{
Dictionary<string, string> values = new Dictionary<string, string>();
foreach (XElement column in record.Elements("Column"))
{
int index = int.Parse(column.AttributeText("Index"));
string value = (column.Value);
values.Add(indexToFIeldName[index], value);
}
DataGridViewRow row = new DataGridViewRow();
row.Tag = values["uid"];
row.CreateCells(dgvTransfers, values["name"], values["token"], values["status"], values["target"]);
dgvTransfers.Rows.Add(row);
}
}
}