本文整理汇总了C#中System.Windows.Forms.DataGridView.SetBounds方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridView.SetBounds方法的具体用法?C# DataGridView.SetBounds怎么用?C# DataGridView.SetBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridView
的用法示例。
在下文中一共展示了DataGridView.SetBounds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeComponent
private void InitializeComponent()
{
this.SuspendLayout();
// ComboBox bucketList
bucketBox.DropDownStyle = ComboBoxStyle.DropDownList;
bucketBox.Items.Add(this.defaultBucketItem);
bucketBox.SelectedItem = this.defaultBucketItem;
bucketBox.SetBounds(0, 0, 200, 0);
bucketBox.Font = this.defaultFont;
bucketBox.SelectedIndexChanged += new EventHandler(this.changeBucketHandler);
this.Controls.Add(bucketBox);
// DataGridView objectsView
objectsView = new DataGridView();
objectsView.Font = this.defaultFont;
objectsView.ColumnHeadersHeight = 30;
objectsView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
objectsView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders;
objectsView.RowHeadersVisible = false;
objectsView.AllowUserToAddRows = false;
objectsView.AllowUserToResizeRows = false;
objectsView.AllowUserToResizeColumns = false;
objectsView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
objectsView.SetBounds(0, 50, 700, 450);
objectsView.ColumnCount = 3;
objectsView.Columns[0].Name = "文件";
objectsView.Columns[1].Name = "大小";
objectsView.Columns[2].Name = "修改时间";
objectsView.ReadOnly = true;
this.Controls.Add(objectsView);
objectsView.Columns.Add(downloadColumn);
objectsView.Columns.Add(deleteColumn);
downloadColumn.Name = "";
downloadColumn.UseColumnTextForButtonValue = true;
downloadColumn.Text = "下载";
deleteColumn.Name = "";
deleteColumn.UseColumnTextForButtonValue = true;
deleteColumn.Text = "删除";
downloadColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
deleteColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
downloadColumn.Width = 70;
deleteColumn.Width = 70;
objectsView.CellContentClick += new DataGridViewCellEventHandler(this.cellEventHandler);
// 创建bucket
createBucketBtn.Text = "创建Bucket";
createBucketBtn.SetBounds(400, 0, 100, 30);
createBucketBtn.Font = this.defaultFont;
createBucketBtn.Click += new EventHandler(this.createBucketHandler);
this.Controls.Add(createBucketBtn);
// 删除bucket
deleteBucketBtn.Text = "删除Bucket";
deleteBucketBtn.SetBounds(500, 0, 100, 30);
deleteBucketBtn.Font = this.defaultFont;
deleteBucketBtn.Enabled = false;
deleteBucketBtn.Click += new EventHandler(this.deleteBucketHandler);
this.Controls.Add(deleteBucketBtn);
// 上传文件
uploadFileBtn.Text = "上传文件";
uploadFileBtn.SetBounds(600, 0, 100, 30);
uploadFileBtn.Font = this.defaultFont;
uploadFileBtn.Enabled = false;
uploadFileBtn.Click += new EventHandler(this.uploadFileHandler);
this.Controls.Add(uploadFileBtn);
// KS3Browser
this.AutoScaleMode = AutoScaleMode.Font;
this.ClientSize = new Size(700, 500);
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.StartPosition = FormStartPosition.CenterScreen;
this.Name = "KS3 Simple Browser";
this.Text = "KS3 Simple Browser";
this.Load += new System.EventHandler(this.KS3Browser_Load);
this.ResumeLayout(false);
}
示例2: ClassDes_Options
public ClassDes_Options()
{
InitializeComponent();
this.AutoHidePortion = 0.2f;
this.HideOnClose = true;
this.Text = "Class Design Options";
this.TabText = "Class Design Options";
this.ToolTipText = "Class Design Options";
// events to make sure that only one sort button is active at a time.
m_oSortAlphaRadioButton.CheckedChanged += new EventHandler(m_oSortAlphaRadioButton_CheckedChanged);
m_oSortCostRadioButton.CheckedChanged += new EventHandler(m_oSortCostRadioButton_CheckedChanged);
m_oSortHullRadioButton.CheckedChanged += new EventHandler(m_oSortHullRadioButton_CheckedChanged);
m_oSortSizeRadioButton.CheckedChanged += new EventHandler(m_oSortSizeRadioButton_CheckedChanged);
m_oComponentDataGrid = new DataGridView();
m_oComponentDataGrid.Dock = DockStyle.Top;
m_oComponentDataGrid.SetBounds(3, 3, 745, 350);
m_oComponentDataGrid.AllowUserToAddRows = false;
m_oComponentDataGrid.AllowUserToDeleteRows = false;
m_oComponentDataGrid.AllowUserToOrderColumns = false;
m_oComponentDataGrid.AllowUserToResizeColumns = false;
m_oComponentDataGrid.AllowUserToResizeRows = false;
m_oComponentDataGrid.MultiSelect = false;
m_oComponentDataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
m_oComponentDataGrid.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
m_oComponentDataGrid.ReadOnly = true;
m_oComponentDataGrid.Enabled = true;
this.m_oAvailCompGroupBox.Controls.Add(m_oComponentDataGrid);
m_oMissileDataGrid = new DataGridView();
m_oMissileDataGrid.Dock = DockStyle.Top;
m_oMissileDataGrid.SetBounds(3, 3, 745, 350);
m_oMissileDataGrid.AllowUserToAddRows = false;
m_oMissileDataGrid.AllowUserToDeleteRows = false;
m_oMissileDataGrid.AllowUserToOrderColumns = false;
m_oMissileDataGrid.AllowUserToResizeColumns = false;
m_oMissileDataGrid.AllowUserToResizeRows = false;
m_oMissileDataGrid.MultiSelect = false;
m_oMissileDataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
m_oMissileDataGrid.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
m_oMissileDataGrid.RowHeadersVisible = false;
m_oMissileDataGrid.ReadOnly = true;
m_oMissileDataGrid.Enabled = true;
this.m_oMissileGroupBox.Controls.Add(m_oMissileDataGrid);
m_oFighterDataGrid = new DataGridView();
m_oFighterDataGrid.Dock = DockStyle.Top;
m_oFighterDataGrid.SetBounds(3, 3, 745, 350);
m_oFighterDataGrid.AllowUserToAddRows = false;
m_oFighterDataGrid.AllowUserToDeleteRows = false;
m_oFighterDataGrid.AllowUserToOrderColumns = false;
m_oFighterDataGrid.AllowUserToResizeColumns = false;
m_oFighterDataGrid.AllowUserToResizeRows = false;
m_oFighterDataGrid.MultiSelect = false;
m_oFighterDataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
m_oFighterDataGrid.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
m_oFighterDataGrid.RowHeadersVisible = false;
m_oFighterDataGrid.ReadOnly = true;
m_oFighterDataGrid.Enabled = true;
this.m_oStrikeGroupBox.Controls.Add(m_oFighterDataGrid);
}
示例3: InputBoxInteractByName
public static DialogResult InputBoxInteractByName(int ProfileID, string title, string promptText, ref string value)
{
Form form = new Form();
DataGridView GridView = new DataGridView();
Button buttonOk = new Button();
Button buttonCancel = new Button();
buttonOk.FlatStyle = FlatStyle.Flat;
buttonCancel.FlatStyle = FlatStyle.Flat;
form.Text = title;
buttonOk.Text = "OK";
buttonCancel.Text = "Cancel";
buttonOk.DialogResult = DialogResult.OK;
buttonCancel.DialogResult = DialogResult.Cancel;
GridView.SetBounds(4, 4, 499, 326);
buttonOk.SetBounds(408, 336, 95, 23);
buttonCancel.SetBounds(307, 336, 95, 23);
form.ClientSize = new Size(507, 365);
form.Controls.AddRange(new Control[] { GridView, buttonOk, buttonCancel });
form.FormBorderStyle = FormBorderStyle.FixedDialog;
form.StartPosition = FormStartPosition.CenterScreen;
form.MinimizeBox = false;
form.MaximizeBox = false;
form.AcceptButton = buttonOk;
form.CancelButton = buttonCancel;
GridView.ColumnCount = 5;
GridView.AllowUserToResizeColumns = false;
GridView.AllowUserToResizeRows = false;
GridView.MultiSelect = false;
GridView.Columns[0].Name = "Type";
GridView.Columns[0].Width = 60;
GridView.Columns[1].Name = "ModelName";
GridView.Columns[1].FillWeight = 100;
GridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
GridView.Columns[2].Name = "ACDPtr";
GridView.Columns[2].Width = 80;
GridView.Columns[3].Name = "Model ID";
GridView.Columns[3].Width = 80;
GridView.Columns[4].Name = "Distance";
GridView.Columns[4].Width = 75;
GridView.RowHeadersVisible = false;
GridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
if (Profile.MyProfiles[ProfileID].D3Process != null)
{
Profile.MyProfiles[ProfileID].D3Cmd(IPlugin.COMMANDS.D3_Update);
if (Profile.MyProfiles[ProfileID].D3Mail.D3Info.InGame == 1)
{
for (int i = 0; i < Profile.MyProfiles[ProfileID].D3Mail.D3Info.Actor.Length; ++i)
{
if (Profile.MyProfiles[ProfileID].D3Mail.D3Info.Actor[i].ACDPTR == 0) continue;
GridView.Rows.Add(Enum.GetName(typeof(IPlugin.UnitType), Profile.MyProfiles[ProfileID].D3Mail.D3Info.Actor[i].Type), Profile.MyProfiles[ProfileID].D3Mail.D3Info.Actor[i].Name.Split('-')[0],
Profile.MyProfiles[ProfileID].D3Mail.D3Info.Actor[i].ACDPTR.ToString("X"),
"0x"+Profile.MyProfiles[ProfileID].D3Mail.D3Info.Actor[i].ModelID.ToString("X"),
Math.Round(Math.Sqrt(Math.Pow(Profile.MyProfiles[ProfileID].D3Mail.D3Info.X - Profile.MyProfiles[ProfileID].D3Mail.D3Info.Actor[i].X, 2) + Math.Pow(Profile.MyProfiles[ProfileID].D3Mail.D3Info.Y - Profile.MyProfiles[ProfileID].D3Mail.D3Info.Actor[i].Y, 2)), 0));
}
}
else
{
GridView.Rows.Add("", "Please stay InGame to use this.");
}
}
else
GridView.Rows.Add("", "Please run the game before using this.");
DialogResult dialogResult = form.ShowDialog();
if (GridView.CurrentRow != null && GridView[1, GridView.CurrentRow.Index].Value != null)
value = GridView[1,GridView.CurrentRow.Index].Value.ToString();
return dialogResult;
}