更新时间:2022-10-23 11:34:50
我建议你阅读:关于滚动条 - 滚动条可见性 [ ^ ]
看看WinForm AutoScroll [ ^ ]属性,指示表单是否启用自动滚动。
用作MdiParentForm的表单不能将'AutoScroll设置为'false:在设计时,如果将其'AutoScroll设置为'为true,它将是自动将'IsMdiContainer属性设置为'false。将'IsMdiContainer设置为'true会自动将'AutoScroll属性设置为'false。
您看到的Scrollbars的唯一来源必须在于您的MdiChildForm将'AutoScroll设置为'为true,并且子窗体的内容超出窗体的边界,当它显示在MdiParentForm中最大化时。
尝试添加_ manageUsers.AutoScroll = false ;
到您创建子表单的代码。
设置表单边框样式的子项,FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
This is the code for ToolStripMenuItem item click event
private void manageUsersToolStripMenuItem_Click(object sender, EventArgs e)
{
//"ManageUsers" is child form
ManageUsers _manageUsers = new ManageUsers() {
MdiParent = this ,
Dock= DockStyle.Fill,
WindowState= FormWindowState.Maximized
};
_manageUsers.Show();
}
But i'm still getting scroll bars :-(
I'm I doing something wrong??
I suggest to read this: About Scroll Bars - Scroll Bar visibility[^]
Have a look at WinForm AutoScroll[^] property which indicates whether the form enables autoscrolling.
A Form used as a MdiParentForm cannot have 'AutoScroll set to 'false: at design-time, if you set its 'AutoScroll to 'true, it will automatically set the the 'IsMdiContainer property to 'false. Setting 'IsMdiContainer to 'true will automatically set the 'AutoScroll property to 'false.
The only source of the Scrollbars you are seeing must lie in the fact that your MdiChildForm has 'AutoScroll set to 'true, and the child Form has content that exceeds the Bounds of the Form when it is displayed Maximized in the MdiParentForm.
Try adding_manageUsers.AutoScroll = false;
to your code that creates the child Form.
set form border style of child,FormBorderStyle = System.Windows.Forms.FormBorderStyle.None