将两种形式作为单个单元...... [英] Make two forms as single unit ...

查看:84
本文介绍了将两种形式作为单个单元......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有两种形式。

第一种形式显示控件和计算按钮。

第二种形式包含处理栏的Gif图像并且这个表单是使用线程打开的。

当我点击计算按钮时我会显示处理表格(第二个表格使用线程)。

但这两个表格显示为单独的表格当我按下Alt + Tab键时,

那么我如何将这两个表单作为单个单元,这样它在Alt + Tab中显示单个表单。



请参阅以下计算按钮点击事件: -



Hi,
I have two forms.
First form displays controls and calculate button.
Second form contains Gif image of processing bar and this form is opened using thread.
when i click on calculate button i displays processing form (second form using thread).
But these two forms are shown as seperate forms when i press Alt+Tab key,
So how can i make these two forms as single unit, so that it displays single form in Alt+Tab .

Refer following calculate button click event:-

private void btnCalculate_Click(object sender, EventArgs e)
        {
            //display Processing form (shows processing.gif image)
            //call calculation function
            //close Processing form
        }

推荐答案

将第二个Form的'ShowInTaskBar属性设置为'false,这样它就不会出现在TaskBar中,或者在你使用Alt-时出现Tab。



你可能想要确定并将第二个Form的'TopMost属性设置为'true,以确保它保留在第一个Form的前面。



我不确定你的意思是作为一个单元出现,但你可以通过将'FormBorderStyle'设置为'来使第二个Form显得裸露 FixedToolWindow,将其'Text Property设置为空字符串,将'ControlBox属性设置为'false。
Set the 'ShowInTaskBar Property of the second Form to 'false so it will not appear in the TaskBar, or appear when you use Alt-Tab.

You might want to be sure and set the second Form's 'TopMost property to 'true to make sure it stays in front of the first Form.

I'm not sure exactly what you mean by "appear as a single unit," but you can make the second Form appear rather "bare" by setting its 'FormBorderStyle to 'FixedToolWindow, setting its 'Text Property to an empty string, setting the 'ControlBox property to 'false.


使用 ShowDialog [ ^ ]而不是 Show()



use ShowDialog[^] instead of Show()

Form2 obj = new Form2();
            obj.ShowDialog();


这篇关于将两种形式作为单个单元......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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