Windows应用程序中表单中控件的控件可见性控制问题 [英] Problem in Controlling Visibility Properties of the controls present in forms in Windows apps

查看:59
本文介绍了Windows应用程序中表单中控件的控件可见性控制问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,

我正在Windows应用程序中工作,该应用程序包含3个分组框&通过动态更改表单和控件的大小,使3个组框充当3个表单.可见性属性.
问题在于管理控件的可见性.
我在第三个分组框中有一个主页"按钮,实际上它似乎是第三个页面.尽管我在按钮单击事件主页"中将第一个分组框的可见性属性设置为true,但我无法查看单击主页"按钮上的第一个分组框(似乎是第一页).


请建议解决此问题.

问候
Aabi

Hi friends,

I am working in windows application which contains 3 groupboxes & the few controls are placed in it.3 groupboxes is made to act as 3 forms by dynamically changing the size of the forms & the visibility properties respectively.
The problem is managing the visibility properites of the controls.
I have a button "Home" in the 3rd groupbox which appears to be the 3rd page physically.Though I had set the visibility property of the 1st groupbox to be true in the button click event "Home", I am not able to view the first groupbox (which appears to be the 1st page)on clicking "Home" Button.


Kindly advise to solve this problem.

Regards
Aabi

推荐答案

也许在按钮单击事件"Home"中,您还需要先隐藏其他分组框.
Perhaps in button click event "Home" you need also to hide the other groupboxes first.


我个人不会为此使用组"框,我可能会使用面板.但是,同样,GroupBoxes也可以使用.

我创建了一个新表单,并在其上放置了两个组框.
每个盒子都有一个按钮.
Personally, I wouldn''t use a Group box for this, I''d probably use a panel. But, all the same, GroupBoxes will work.

I created a new form, and dropped two group boxes on to it.
Each box got a button.
private void button1_Click(object sender, EventArgs e)
    {
    groupBox1.Visible = false;
    groupBox2.Visible = true;
    }
private void button2_Click(object sender, EventArgs e)
    {
    groupBox1.Visible = true;
    groupBox2.Visible = false;
    }

按预期效果很好.
我想您要做的是创建组框,填充它们,然后拖动它们以便它们全部重叠.您实际上所做的是使各个框相互容纳-您已将一个组合框放到另一个框上.

回到设计模式,并将它们分开,以便它们都分别位于表单上.现在更改它们中的每个,以便将Dock属性设置为Fill.它将起作用-但您最好还是使用标签页或面板恕我直言.

As expected it worked fine.
What I supect you have done is created your group boxes, populated them, and dragged them so they all overlap. What you have actually done is made your boxes contain each other - you have dropped a group box onto another.

Go back to design mode, and separate them so they are all sitting on the form separately. Now change each of them so that Dock Property is set to Fill. It will work - but you would still be better with either tab pages or panels IMHO.


这篇关于Windows应用程序中表单中控件的控件可见性控制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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