C#之显示效果

窗体最大化(包含任务栏):

1 this.TopMost = true;
2 this.Location = new Point(0, 0);
3 this.Size = Screen.PrimaryScreen.Bounds.Size;

窗体最大化(不包含任务栏):

1 this.Location = new Point(0, 0);
2 this.Size = Screen.PrimaryScreen.WorkingArea.Size;

textbox滚动到最下端:

1 textBox.SelectionStart = textBox.TextLength - 1;
2 textBox.ScrollToCaret();

DatagridView滚动到最下:

1 //计算dataGridView1可显示的最多行数
2 int count = (dataGridView1.Height - dataGridView1.RowHeadersWidth) / dataGridView1.Rows[0].Height;
3 //设定最上端的显示行
4 dataGridView1.FirstDisplayedScrollingRowIndex = num - count;

TabControl页面切换

 1    private void btnPage1_Click(object sender, EventArgs e)
 2    {
 3        tabPage1.Parent = this.tabControl1;
 4        tabPage2.Parent = null;
 5    }
 6 
 7    private void btnPage2_Click(object sender, EventArgs e)
 8    {
 9        tabPage1.Parent = null;
10        tabPage2.Parent = this.tabControl1;
11    }
原文地址:https://www.cnblogs.com/imstrive/p/5779063.html