本示例动态演示了 RibbonControls 的合并机制。 主/子 MDI 窗体都包含了 RibbonControls。 当子窗体被最大化时,子窗体的 RibbonControl 被合并到主窗体的 RibbonControl。
C# | 复制代码 |
---|
(Form1.cs)
private void Form1_Load(object sender, EventArgs e) {
this.ribbonControl1.MdiMergeStyle = RibbonMdiMergeStyle.OnlyWhenMaximized;
CreateChildForm();
}
private void btnNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
CreateChildForm();
}
int ctr = 1;
void CreateChildForm() {
ReportForm child = new ReportForm();
child.Text = "Report " + ctr.ToString();
child.MdiParent = this;
child.Show();
ctr++;
}
|
Visual Basic | 复制代码 |
---|
(Form1.vb)
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Me.ribbonControl1.MdiMergeStyle = RibbonMdiMergeStyle.OnlyWhenMaximized
CreateChildForm()
End Sub
Private Sub btnNew_ItemClick(ByVal sender As Object, ByVal e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnNew.ItemClick
CreateChildForm()
End Sub
Private ctr As Integer = 1
Private Sub CreateChildForm()
Dim child As New ReportForm()
child.Text = "Report " & ctr.ToString()
child.MdiParent = Me
child.Show()
ctr += 1
End Sub
|