且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Visual Studio如何使用页面C#

更新时间:2023-02-08 15:32:57

不要尝试在用户控件中执行此操作:相反,让控件生成下一页请求事件,父表单通过关闭处理控制并开启一个新的。这样,控制器不必知道是否有更多的页面,但是父母 - 毕竟是负责的 - 确实。



听起来可能很复杂,但事实并非如此。请参阅此处:在两个表单之间传输信息,第2部分:从孩子到父母 [ ^ ] - 它是关于表单的讨论,但它对用户控件的工作方式完全相同!
Don;t try to do it from within the user control: instead, have the control generate a "next page request" event which the parent form handles by closing the control and opening a new one. That way, teh control doesn't have to know if there are more pages, but teh parent - which is in charge after all - does.

It may sound complicated, but it isn't, not at all. See here: Transferring information between two forms, Part 2: Child to Parent[^] - it's talks about forms, but it works exactly the same way for user controls!


你需要的是一个 TabControl。 [ ^ ]

如果需要,可以这样隐藏标签:如何隐藏TabControl标题 [ ^ ]
What you need is a TabControl.[^]
If you want, you can hide the tabs this way: How to Hide TabControl Headers[^]