C#winforms是否具有类似"ViewStack"的控件?在Flex中? [英] Does C# winforms has a control like "ViewStack" in Flex?

查看:84
本文介绍了C#winforms是否具有类似"ViewStack"的控件?在Flex中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Flex中,有 ViewStack 组件. C#是否具有类似的控件?
如果是这样,哪一个?如果没有,您如何创建类似的行为?

In Flex there is the ViewStack component. Does C# have a similar control?
If so, which? If not, how do you create similar behavior?

推荐答案

是的,TabControl组件以这种方式工作.您所要做的就是隐藏选项卡.在您的项目中添加一个新类,并粘贴以下代码.编译.将新控件从工具箱的顶部拖放到您的窗体上.这些选项卡在设计时仍然可见,因此可以轻松编辑页面.但是在运行时隐藏.使用SelectedTab或SelectedIndex属性选择视图.

Yes, the TabControl component works this way. All you have to do is hide the tabs. Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form. The tabs are still visible at design time, makes it easy to edit the pages. But hidden at runtime. Use the SelectedTab or SelectedIndex property to select the view.

using System;
using System.Windows.Forms;

class ViewStack : TabControl {
  protected override void WndProc(ref Message m) {
    // Hide tabs by trapping the TCM_ADJUSTRECT message
    if (m.Msg == 0x1328 && !DesignMode) m.Result = (IntPtr)1;
    else base.WndProc(ref m);
  }
}

这篇关于C#winforms是否具有类似"ViewStack"的控件?在Flex中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆