按下时如何显示其他表格的当前表格 [英] How to display another form current form when press

查看:108
本文介绍了按下时如何显示其他表格的当前表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以当前形式显示其他形式,例如菜单
当按下列表框项目时,在列表框的侧面显示另一种形式

[edit]已删除主题,拼写和虚假字符-OriginalGriff [/edit]

how to display another form in current form like menu
when press list box item display the another form in side of list box

[edit]Subject, spelling, spurious characters removed - OriginalGriff[/edit]

推荐答案

您无法在表单中显示表单,除非您正在使用MDI表单,否则我认为这不是您想要的.

取而代之的是,使用Panel并在运行时将其填充控件,或者创建UserControl-如果需要,它可以像表单中的表单一样工作:它是一个独立的单个对象,可提供信息. Google将帮助您创建一个.
You can''t display a form within a form, that doesn''t work unless you are using MDI forms, which I suspect are not what you want.

Instead, use a Panel and fill it with controls at run time, or create a UserControl - this could act very like a form within your form if you need it to: It is an independent single-object that you feed information. Google will help you to create one.


我建议创建并使用用户控件来获取弹出窗口的最佳方法.

但是,如果您仍然想使用该表单在列表框中弹出,则可以执行以下操作;

-将FormBorderStyle属性设置为无",
-添加一个确定"(名称:btnOK)并单击取消"(名称:btnCancel)按钮
-将AcceptButton属性值设置为"btnOk"& CancelButton属性值为``btnCancel''

并使用下面的代码显示弹出窗口,只要您想在ListBox上单击或右键单击等即可.

The best way I recommend to create and use a user control for getting the pop-up.

But if you still want to use the form to pop-up on the list box you can do the following;

- Set the FormBorderStyle property to ''None'',
- Add an OK (Name: btnOK) and Cancel (Name: btnCancel) button
- set the AcceptButton property value as ''btnOk'' & CancelButton property value as ''btnCancel''

And use the below code to show the pop-up whenever you want like on ListBox click or right click etc..

Private Sub ShowOnListBox()
    Dim frm As New PopUpForm
    frm.Left = objListBox.Left + 2
    frm.Top = objListBox.Top + 2
    If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then
        '' Do processing
    End If
End Sub


这篇关于按下时如何显示其他表格的当前表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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