本文整理汇总了C#中System.Windows.Forms.DataGridView.Show方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridView.Show方法的具体用法?C# DataGridView.Show怎么用?C# DataGridView.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridView
的用法示例。
在下文中一共展示了DataGridView.Show方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
private void Setup()
{
Text = "Destination Types";
Size = new Size(298, 400);
MinimumSize = new Size(298, 400);
MaximumSize = new Size(298, 400);
ShowIcon = false;
MinimizeBox = false;
MaximizeBox = false;
SizeGripStyle = SizeGripStyle.Hide;
StartPosition = FormStartPosition.CenterParent;
ColorPicker = new ColorDialog();
SetName = new TextBox();
SetName.Location = new Point(63, 12);
SetName.Size = new Size(120, 22);
Controls.Add(SetName);
NameLabel = new Label();
NameLabel.Text = "Name";
NameLabel.Location = new Point(12, 15);
Controls.Add(NameLabel);
SetColor = new Button();
SetColor.BackColor = ColorPicker.Color;
SetColor.Location = new Point(189, 12);
SetColor.Size = new Size(23, 23);
SetColor.Click += ClickColor;
Controls.Add(SetColor);
Add = new Button();
Add.Text = "Add";
Add.Location = new Point(218, 12);
Add.Size = new Size(50, 23);
Add.Click += AddClick;
Controls.Add(Add);
Remove = new Button();
Remove.Text = "Remove";
Remove.Location = new Point(193, 320);
Remove.Size = new Size(75, 23);
Remove.Click += RemoveClick;
Controls.Add(Remove);
Destinations = new DataGridView();
Destinations.Location = new Point(12, 41);
Destinations.Size = new Size(256, 273);
Destinations.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
Destinations.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
Destinations.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
Destinations.AllowUserToResizeColumns = false;
Destinations.AllowUserToResizeRows = false;
Destinations.RowHeadersVisible = false;
Destinations.ReadOnly = true;
Controls.Add(Destinations);
Destinations.Show();
}
示例2: ToForm
public static Form ToForm(this XElement xml)
{
var f = new Form
{
Text = "SQL results"
};
var g = new DataGridView();
g.Dock = DockStyle.Fill;
f.Controls.Add(g);
g.Show();
g.Columns.AddRange(
xml.Element("th").Elements().Select(
td => new DataGridViewTextBoxColumn { HeaderText = td.Value + " " + td.Attribute("title").Value }
).ToArray()
);
g.Rows.AddRange(
xml.Elements("tr").Select(
tr =>
new DataGridViewRow().With(
r =>
{
r.Cells.AddTextRange(
tr.Elements().Select(td => td.Value).ToArray()
);
}
)
).ToArray()
);
f.Show();
f.GetHTMLTarget().AttachTo(Native.Document.body.parentNode);
return f;
}
示例3: Paste
private void Paste(DataGridView dataGridView, bool enumerateProteins)
{
string text;
try
{
text = ClipboardEx.GetText();
}
catch (ExternalException)
{
MessageDlg.Show(this, ClipboardHelper.GetOpenClipboardMessage(Resources.PasteDlg_Paste_Failed_getting_data_from_the_clipboard));
return;
}
int numUnmatched;
int numMultipleMatches;
int numFiltered;
int prevRowCount = dataGridView.RowCount;
try
{
Paste(dataGridView, text, enumerateProteins, enumerateProteins, out numUnmatched,
out numMultipleMatches, out numFiltered);
}
// User pasted invalid text.
catch(InvalidDataException e)
{
dataGridView.Show();
// Show the invalid text, then remove all newly added rows.
MessageDlg.ShowException(this, e);
RemoveLastRows(dataGridView, dataGridView.RowCount - prevRowCount);
return;
}
// If we have no unmatched, no multiple matches, and no filtered, we do not need to show
// the FilterMatchedPeptidesDlg.
if (numUnmatched + numMultipleMatches + numFiltered == 0)
return;
using (var filterPeptidesDlg =
new FilterMatchedPeptidesDlg(numMultipleMatches, numUnmatched, numFiltered,
dataGridView.RowCount - prevRowCount == 1))
{
var result = filterPeptidesDlg.ShowDialog(this);
// If the user is keeping all peptide matches, we don't need to redo the paste.
bool keepAllPeptides = ((FilterMultipleProteinMatches ==
BackgroundProteome.DuplicateProteinsFilter.AddToAll || numMultipleMatches == 0)
&& (Settings.Default.LibraryPeptidesAddUnmatched || numUnmatched == 0)
&& (Settings.Default.LibraryPeptidesKeepFiltered || numFiltered == 0));
// If the user is filtering some peptides, or if the user clicked cancel, remove all rows added as
// a result of the paste.
if (result == DialogResult.Cancel || !keepAllPeptides)
RemoveLastRows(dataGridView, dataGridView.RowCount - prevRowCount);
// Redo the paste with the new filter settings.
if (result != DialogResult.Cancel && !keepAllPeptides)
Paste(dataGridView, text, enumerateProteins, !enumerateProteins, out numUnmatched,
out numMultipleMatches, out numFiltered);
}
}
示例4: Setup
private void Setup()
{
Text = "Edit Node";
ShowIcon = false;
MinimizeBox = false;
MaximizeBox = false;
SizeGripStyle = SizeGripStyle.Hide;
SetSize(229, 145);
PositionLabel = new Label();
PositionLabel.Text = "Position";
PositionLabel.Location = new Point(12, 15);
PositionLabel.AutoSize = true;
Controls.Add(PositionLabel);
Position = new TextBox();
Position.Text = Node.Position.X + ", " + Node.Position.Y;
Position.Location = new Point(76, 12);
Position.Size = new Size(120, 22);
Position.Enabled = false;
Controls.Add(Position);
TypeLabel = new Label();
TypeLabel.Text = "Type";
TypeLabel.Location = new Point(12, 43);
TypeLabel.AutoSize = true;
Controls.Add(TypeLabel);
Type = new ComboBox();
Type.Location = new Point(76, 40);
Type.Size = new Size(120, 24);
Type.DropDownStyle = ComboBoxStyle.DropDownList;
Controls.Add(Type);
GreenCheck = new CheckBox();
GreenCheck.Text = "Green (Light)";
GreenCheck.Location = new Point(76, 70);
GreenCheck.AutoSize = true;
GreenCheck.Checked = Node.Green;
Controls.Add(GreenCheck);
if (Node.Roads.Count > 0)
{
SetSize(547, 280);
RoadsLabel = new Label();
RoadsLabel.Text = "Roads";
RoadsLabel.Location = new Point(208, 15);
RoadsLabel.AutoSize = true;
Controls.Add(RoadsLabel);
Roads = new DataGridView();
Roads.Location = new Point(221, 36);
Roads.Size = new Size(303, 158);
Roads.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
Roads.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
Roads.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
Roads.AllowUserToResizeColumns = false;
Roads.AllowUserToResizeRows = false;
Roads.RowHeadersVisible = false;
Roads.ReadOnly = true;
Controls.Add(Roads);
Roads.Show();
Remove = new Button();
Remove.Location = new Point(439, 200);
Remove.Size = new Size(75, 23);
Remove.Text = "Remove";
Remove.Click += RemoveRoadClick;
Controls.Add(Remove);
}
}
示例5: _formatingDataGridNEW
private void _formatingDataGridNEW(DataGridView dg)
{
dg.Columns[0].FillWeight = 2;
dg.Columns[1].FillWeight = 2;
dg.Columns[2].FillWeight = 2;
dg.Columns[3].FillWeight = 2;
dg.Columns[4].FillWeight = 3;
dg.Columns[5].FillWeight = 20;
dg.Columns[6].FillWeight = 17;
dg.Columns[7].FillWeight = 20;
dg.Columns[0].Visible = false;
dg.Columns[1].Visible = false;
dg.Columns[2].Visible = false;
dg.Columns[3].Visible = false;
dg.Columns[4].Visible = false;
dg.Columns[5].Visible = true;
dg.Columns[6].Visible = true;
dg.Columns[7].Visible = true;
_setColorForDataGrid(dg);
dg.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dg.Refresh();
dg.Show();
}
示例6: Setup
private void Setup()
{
Text = "Distribution";
Size = new Size(378, 350);
MinimumSize = new Size(378, 350);
MaximumSize = new Size(378, 350);
ShowIcon = false;
MinimizeBox = false;
MaximizeBox = false;
SizeGripStyle = SizeGripStyle.Hide;
StartPosition = FormStartPosition.CenterParent;
TabContainer = new TabControl();
TabContainer.Location = new Point(12, 12);
TabContainer.Size = new Size(336, 252);
TabContainer.SelectedIndexChanged += OnSelectedChanged;
Controls.Add(TabContainer);
TabDestinations = new TabPage();
TabDestinations.Text = "Destinations";
TabContainer.TabPages.Add(TabDestinations);
TabVehicles = new TabPage();
TabVehicles.Text = "Vehicles";
TabContainer.TabPages.Add(TabVehicles);
Destinations = new DataGridView();
Destinations.Dock = DockStyle.Fill;
Destinations.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
Destinations.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
Destinations.AllowUserToResizeColumns = false;
Destinations.AllowUserToResizeRows = false;
Destinations.RowHeadersVisible = false;
Destinations.EditingControlShowing += OnEditingControlShowing;
Destinations.CellEndEdit += UpdatePercentage;
TabDestinations.Controls.Add(Destinations);
Destinations.Show();
Vehicles = new DataGridView();
Vehicles.Dock = DockStyle.Fill;
Vehicles.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
Vehicles.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
Vehicles.AllowUserToResizeColumns = false;
Vehicles.AllowUserToResizeRows = false;
Vehicles.RowHeadersVisible = false;
Vehicles.EditingControlShowing += OnEditingControlShowing;
Vehicles.CellEndEdit += UpdatePercentage;
TabVehicles.Controls.Add(Vehicles);
Vehicles.Show();
DestinationsPercent = new TextBox();
DestinationsPercent.Text = "0%";
DestinationsPercent.Location = new Point(104, 270);
DestinationsPercent.Size = new Size(45, 22);
DestinationsPercent.Enabled = false;
DestinationsPercent.ReadOnly = true;
Controls.Add(DestinationsPercent);
VehiclesPercent = new TextBox();
VehiclesPercent.Text = "0%";
VehiclesPercent.Location = new Point(222, 270);
VehiclesPercent.Size = new Size(45, 22);
VehiclesPercent.Enabled = false;
VehiclesPercent.ReadOnly = true;
Controls.Add(VehiclesPercent);
Save = new Button();
Save.Text = "Save";
Save.Location = new Point(273, 270);
Save.Size = new Size(75, 23);
Save.Click += SaveData;
Controls.Add(Save);
DestinationsLabel = new Label();
DestinationsLabel.Text = "Destinations";
DestinationsLabel.Location = new Point(12, 273);
Controls.Add(DestinationsLabel);
VehiclesLabel = new Label();
VehiclesLabel.Text = "Vehicles";
VehiclesLabel.Location = new Point(155, 273);
Controls.Add(VehiclesLabel);
}
示例7: Setup
private void Setup()
{
Text = "Road Types";
Size = new Size(243, 400);
MinimumSize = new Size(243, 400);
MaximumSize = new Size(243, 400);
ShowIcon = false;
MinimizeBox = false;
MaximizeBox = false;
SizeGripStyle = SizeGripStyle.Hide;
StartPosition = FormStartPosition.CenterParent;
SetName = new TextBox();
SetName.Location = new Point(67, 12);
SetName.Size = new Size(80, 22);
Controls.Add(SetName);
SetSpeed = new NumericUpDown();
SetSpeed.Location = new Point(67, 40);
SetSpeed.Size = new Size(80, 22);
SetSpeed.Maximum = 10000;
SetSpeed.Minimum = 0;
Controls.Add(SetSpeed);
NameLabel = new Label();
NameLabel.Text = "Name";
NameLabel.Location = new Point(16, 15);
NameLabel.AutoSize = true;
Controls.Add(NameLabel);
SpeedLabel = new Label();
SpeedLabel.Text = "Speed";
SpeedLabel.Location = new Point(12, 42);
SpeedLabel.AutoSize = true;
Controls.Add(SpeedLabel);
Add = new Button();
Add.Text = "Add";
Add.Location = new Point(169, 39);
Add.Size = new Size(50, 23);
Add.Click += AddClick;
Controls.Add(Add);
Remove = new Button();
Remove.Text = "Remove";
Remove.Location = new Point(138, 320);
Remove.Size = new Size(75, 23);
Remove.Click += RemoveClick;
Controls.Add(Remove);
Roads = new DataGridView();
Roads.Location = new Point(12, 68);
Roads.Size = new Size(201, 246);
Roads.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
Roads.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
Roads.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
Roads.AllowUserToResizeColumns = false;
Roads.AllowUserToResizeRows = false;
Roads.RowHeadersVisible = false;
Roads.ReadOnly = true;
Controls.Add(Roads);
Roads.Show();
}
示例8: Setup
private void Setup()
{
Text = "Vehicle Types";
Size = new Size(700, 233);
MinimumSize = new Size(700, 233);
MaximumSize = new Size(700, 233);
ShowIcon = false;
MinimizeBox = false;
MaximizeBox = false;
SizeGripStyle = SizeGripStyle.Hide;
StartPosition = FormStartPosition.CenterParent;
ColorPicker = new ColorDialog();
SetName = new TextBox();
SetName.Location = new Point(106, 12);
SetName.Size = new Size(90, 22);
Controls.Add(SetName);
MaxSpeed = new NumericUpDown();
MaxSpeed.Location = new Point(106, 40);
MaxSpeed.Size = new Size(90, 22);
MaxSpeed.Maximum = 1228;
MaxSpeed.Minimum = 0;
Controls.Add(MaxSpeed);
Acceleration = new NumericUpDown();
Acceleration.Location = new Point(106, 68);
Acceleration.Size = new Size(90, 22);
Acceleration.Maximum = 10;
Acceleration.Minimum = 0;
Controls.Add(Acceleration);
Deceleration = new NumericUpDown();
Deceleration.Location = new Point(106, 96);
Deceleration.Size = new Size(90, 22);
Deceleration.Maximum = 0;
Deceleration.Minimum = -10;
Controls.Add(Deceleration);
NameLabel = new Label();
NameLabel.Text = "Name";
NameLabel.Location = new Point(55, 15);
Controls.Add(NameLabel);
MaxSpeedLabel = new Label();
MaxSpeedLabel.Text = "MaxSpeed";
MaxSpeedLabel.Location = new Point(22, 42);
Controls.Add(MaxSpeedLabel);
AccelerationLabel = new Label();
AccelerationLabel.Text = "Acceleration";
AccelerationLabel.Location = new Point(14, 70);
Controls.Add(AccelerationLabel);
DecelerationLabel = new Label();
DecelerationLabel.Text = "Deceleration";
DecelerationLabel.Location = new Point(12, 98);
Controls.Add(DecelerationLabel);
Add = new Button();
Add.Text = "Add";
Add.Location = new Point(146, 124);
Add.Size = new Size(50, 23);
Add.Click += AddClick;
Controls.Add(Add);
SetColor = new Button();
SetColor.BackColor = ColorPicker.Color;
SetColor.Location = new Point(117, 124);
SetColor.Size = new Size(23, 23);
SetColor.Click += ClickColor;
Controls.Add(SetColor);
Remove = new Button();
Remove.Text = "Remove";
Remove.Location = new Point(595, 153);
Remove.Size = new Size(75, 23);
Remove.Click += RemoveClick;
Controls.Add(Remove);
Vehicles = new DataGridView();
Vehicles.Location = new Point(202, 12);
Vehicles.Size = new Size(468, 135);
Vehicles.DataSource = Project.VehicleTypes;
Vehicles.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
Vehicles.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
Vehicles.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
Vehicles.AllowUserToResizeColumns = false;
Vehicles.AllowUserToResizeRows = false;
Vehicles.RowHeadersVisible = false;
Vehicles.ReadOnly = true;
Controls.Add(Vehicles);
Vehicles.Show();
}