Created
August 29, 2013 16:47
-
-
Save viko16/6380562 to your computer and use it in GitHub Desktop.
切换panel的显示和隐藏 #winform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// 切换panel的显示效果 | |
/// </summary> | |
/// <param name="panelname">panel的名字</param> | |
private void changeView(string panelname) | |
{ | |
foreach (Control cn in this.Controls) | |
{ | |
if (cn is Panel) | |
{ | |
if (cn.Name == panelname)//你要显示的panel的名称 | |
{ | |
cn.Visible = true; | |
} | |
else //其余隐藏 | |
{ | |
cn.Visible = false; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment