将图像控件放在MDI窗体中

时间:2022-10-20 10:46:25

I have placed an image controls in center the mdi. But when I an opening a child form the form form appears below the image control.

我在mdi的中心放置了一个图像控件。但是,当我打开一个子表单时,表单形式出现在图像控件下方。

Please help ???

请帮忙 ???

3 个解决方案

#1


A small idea to solve this problem.

解决这个问题的一个小想法。

Use a picture box to show your image in MDI form and try the code below:

使用图片框以MDI格式显示图像,并尝试以下代码:

Private Sub MDIFORM_MdiChildActivate(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.MdiChildActivate

    Dim cnt As Integer = 0
    For Each frm As Form In My.Application.OpenForms
        cnt += 1
    Next
    If cnt > 1 Then
        Me.PictureBox1.Hide()
    Else
        Me.PictureBox1.Show()
    End If
End Sub

#2


Once the outer form is an MdiParent, the mdiclient area will expand to fill all space not used by other containers. So you'll either need to put the image somewhere else (e.g., a panel docked to the left, separated by a Splitter from the mdi client area) or not put the image on child forms.

一旦外部形式是MdiParent,mdiclient区域将扩展以填充其他容器未使用的所有空间。因此,您需要将图像放在其他位置(例如,面板停靠在左侧,由Splitter与mdi客户区域隔开)或不将图像放在子窗体上。

#3


This is the way MDI forms work in .NET. According to my copy of Professional VB 2005 (Wrox), "in VB.NET, an MDI parent can contain any control that a regular form can contain. Buttons, labels, and the like can be placed directly on the MDI surface. Such controls will appear in front of any MDI child forms that are displayed in the MDI client area" (emphasis mine)

这是MDI在.NET中的工作方式。根据我的Professional VB 2005(Wrox)的副本,“在VB.NET中,MDI父级可以包含常规表单可以包含的任何控件。按钮,标签等可以直接放在MDI表面上。这样的控件将显示在MDI客户端区域中显示的任何MDI子窗体的前面“(强调我的)

I imagine what you're trying to do is have some kind of logo appear in the client area in the MDI form? In this case, you will need to draw this in the form's Paint event rather than using an Image control.

我想你要做的是在MDI表格的客户区出现某种标识?在这种情况下,您需要在表单的Paint事件中绘制它,而不是使用Image控件。

#1


A small idea to solve this problem.

解决这个问题的一个小想法。

Use a picture box to show your image in MDI form and try the code below:

使用图片框以MDI格式显示图像,并尝试以下代码:

Private Sub MDIFORM_MdiChildActivate(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.MdiChildActivate

    Dim cnt As Integer = 0
    For Each frm As Form In My.Application.OpenForms
        cnt += 1
    Next
    If cnt > 1 Then
        Me.PictureBox1.Hide()
    Else
        Me.PictureBox1.Show()
    End If
End Sub

#2


Once the outer form is an MdiParent, the mdiclient area will expand to fill all space not used by other containers. So you'll either need to put the image somewhere else (e.g., a panel docked to the left, separated by a Splitter from the mdi client area) or not put the image on child forms.

一旦外部形式是MdiParent,mdiclient区域将扩展以填充其他容器未使用的所有空间。因此,您需要将图像放在其他位置(例如,面板停靠在左侧,由Splitter与mdi客户区域隔开)或不将图像放在子窗体上。

#3


This is the way MDI forms work in .NET. According to my copy of Professional VB 2005 (Wrox), "in VB.NET, an MDI parent can contain any control that a regular form can contain. Buttons, labels, and the like can be placed directly on the MDI surface. Such controls will appear in front of any MDI child forms that are displayed in the MDI client area" (emphasis mine)

这是MDI在.NET中的工作方式。根据我的Professional VB 2005(Wrox)的副本,“在VB.NET中,MDI父级可以包含常规表单可以包含的任何控件。按钮,标签等可以直接放在MDI表面上。这样的控件将显示在MDI客户端区域中显示的任何MDI子窗体的前面“(强调我的)

I imagine what you're trying to do is have some kind of logo appear in the client area in the MDI form? In this case, you will need to draw this in the form's Paint event rather than using an Image control.

我想你要做的是在MDI表格的客户区出现某种标识?在这种情况下,您需要在表单的Paint事件中绘制它,而不是使用Image控件。