本文整理汇总了C#中System.Windows.Forms.DataGridView.BringToFront方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridView.BringToFront方法的具体用法?C# DataGridView.BringToFront怎么用?C# DataGridView.BringToFront使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridView
的用法示例。
在下文中一共展示了DataGridView.BringToFront方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataForm
public DataForm(DataTable[] tables)
{
InitializeComponent();
this.m_tables = tables;
if (tables.Length == 1)
{
DataGridView dgv = new DataGridView();
dgv.Name = "dgv";
dgv.TabIndex = 0;
dgv.DataSource = tables[0];
dgv.Dock = DockStyle.Fill;
Helper.DataGridViewPropSet(dgv);
this.Controls.Add(dgv);
dgv.BringToFront();
}
else
{
TabControl tabControl = new TabControl();
tabControl.Name = "tabControl";
tabControl.Alignment = System.Windows.Forms.TabAlignment.Bottom;
tabControl.Dock = DockStyle.Fill;
string tableName;
for (int i = 0; i < tables.Length; i++)
{
tableName = tables[i].TableName;
TabPage tp = new TabPage();
tp.Text = string.IsNullOrEmpty(tableName) ? "Table" + (i + 1).ToString() : tableName;
tp.Name = "tp" + i.ToString();
tp.Padding = new System.Windows.Forms.Padding(0);
tp.TabIndex = i + 1;
tp.UseVisualStyleBackColor = true;
tabControl.TabPages.Add(tp);
DataGridView dgv = new DataGridView();
dgv.Name = "dgv" + i.ToString();
dgv.TabIndex = i;
dgv.DataSource = tables[i];
dgv.Dock = DockStyle.Fill;
Helper.DataGridViewPropSet(dgv);
tp.Controls.Add(dgv);
}
this.Controls.Add(tabControl);
tabControl.BringToFront();
}
this.Load += DataForm_Load;
}
示例2: SetTablePropertyToCreateTamplate
/// <summary>
/// Задает визуальные свойства таблицы
/// </summary>
/// <param name="Table">Исходная таблица</param>
public static void SetTablePropertyToCreateTamplate(DataGridView Table)
{
Table.AllowUserToOrderColumns = false;
Table.AllowUserToResizeRows = false;
Table.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
Table.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
Table.AllowUserToAddRows = false;
Table.AllowUserToDeleteRows = false;
Table.AllowUserToResizeColumns = false;
Table.BringToFront();
Table.Dock = DockStyle.Fill;
Table.BorderStyle = BorderStyle.None;
foreach (DataGridViewColumn tmp in Table.Columns) {
tmp.SortMode = DataGridViewColumnSortMode.NotSortable;
}
Table.ColumnHeadersHeight = 70;
}
示例3: Show
/// <summary>
/// Show editor for config management
/// </summary>
public void Show()
{
configForm = new Form();
buttonClose = new Button();
buttonCancel = new Button();
dgView = new DataGridView();
dgView.Parent = configForm;
dgView.BringToFront();
dgView.RowHeadersVisible = false;
buttonCancel.Parent = configForm;
buttonClose.Parent = configForm;
configForm.Text = "Config Editor";
configForm.FormBorderStyle = FormBorderStyle.FixedDialog;
configForm.MaximizeBox = false;
configForm.MinimizeBox = false;
configForm.StartPosition = FormStartPosition.CenterParent;
Parameterlist.Clear();
SetSize();
dgView.Rows.Clear();
try
{
Parameterlist = Read();
}
catch
{
MessageBox.Show("File Not Found, creating SQL default");
InitSQLDefaults();
Parameterlist = Read();
}
dgView.Columns.Add("dgName", "Name");
dgView.Columns.Add("dgValue", "Value");
dgView.Columns["dgName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dgView.Columns["dgName"].FillWeight = 40;
dgView.Columns["dgValue"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dgView.Columns["dgValue"].FillWeight = 60;
foreach (CParameter x in Parameterlist)
{
dgView.Rows.Add();
dgView.Rows[dgView.Rows.Count - 2].Cells[0].Value = x.Name;
dgView.Rows[dgView.Rows.Count - 2].Cells[1].Value = x.Value;
}
buttonClose.Click += new EventHandler(buttonClose_Click);
buttonCancel.Click += new EventHandler(buttonCancel_Click);
dgView.KeyDown += new KeyEventHandler(dgView_KeyDown);
configForm.ShowDialog();
configForm.Dispose();
buttonClose.Dispose();
buttonCancel.Dispose();
dgView.Dispose();
GC.Collect();
}
示例4: addTabcontrol
private void addTabcontrol(string devicename)
{
DataGridView DatagridView = new DataGridView();
TabPage myTabPage = new TabPage(devicename); //Create each tab
DataTable tabview = new DataTable();
string[] columnName = { "Date", "Device", "Process", "LogLevel", "Log", "ctr"};
foreach (string name in columnName)
{
DatagridView.Columns.Add(name, name);
}
DatagridView.DefaultCellStyle.Font = new Font("Consolas", 9);
DatagridView.RowTemplate.Height = 80;
DatagridView.CellBorderStyle = DataGridViewCellBorderStyle.None;
DatagridView.AllowUserToResizeRows = true;
DatagridView.AllowUserToAddRows = false;
DatagridView.Columns[0].Width = 130;
DatagridView.Columns[2].Width = 120;
DatagridView.Columns[4].MinimumWidth = 2500;
DatagridView.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
DatagridView.Columns[5].Width = 10;
DatagridView.Columns[5].Visible = false;
foreach (DataGridViewColumn col in DatagridView.Columns)
{
tabview.Columns.Add(col.Name);
col.DataPropertyName = col.Name;
}
DatagridView.BringToFront();
DatagridView.ScrollBars = ScrollBars.Both;
DatagridView.Dock = DockStyle.Fill;
DatagridView.DataSource = tabview;
DatagridView.ContextMenuStrip = mnu;
DatagridView.CellFormatting += dataGridView_CellFormatting;
//add it to the list.
dataGrids.Add(devicename, DatagridView);
dataTables.Add(devicename, tabview);
tabpages.Add(devicename, myTabPage);
myTabPage.Controls.Add(DatagridView);
myTabPage.AutoScroll = true;
tabControl1.TabPages.Add(myTabPage);
}