VB.NET实现Winodws式隐现菜单

主要是通过Panel和ImageButton两个控件实现,很简单.

<Script Language="VB" Runat="Server">

Sub Button1_Click(sender As Object, e As ImageClickEventArgs)

If myPanel1.Visible = True Then

myPanel1.Visible = False

sbmr.ImageUrl="images/sb_show.gif"

Else

myPanel1.Visible = True

sbmr.ImageUrl="images/sb_hide.gif"

End If

End Sub

Sub Button2_Click(sender As Object, e As ImageClickEventArgs)

If myPanel2.Visible = True Then

myPanel2.Visible = False

bjmr.ImageUrl="images/bj_show.gif"

Else

myPanel2.Visible = True

bjmr.ImageUrl="images/bj_hide.gif"

End If

End Sub

Sub Button3_Click(sender As Object, e As ImageClickEventArgs)

If myPanel3.Visible = True Then

myPanel3.Visible = False

bjkc.ImageUrl="images/kc_show.gif"

Else

myPanel3.Visible = True

bjkc.ImageUrl="images/kc_hide.gif"

End If

End Sub

Sub Button4_Click(sender As Object, e As ImageClickEventArgs)

If myPanel4.Visible = True Then

myPanel4.Visible = False

bjrk.ImageUrl="images/rk_show.gif"

Else

myPanel4.Visible = True

bjrk.ImageUrl="images/rk_hide.gif"

End If

End Sub

Sub Button5_Click(sender As Object, e As ImageClickEventArgs)

If myPanel5.Visible = True Then

myPanel5.Visible = False

bjck.ImageUrl="images/ck_show.gif"

Else

myPanel5.Visible = True

bjck.ImageUrl="images/ck_hide.gif"

End If

End Sub

Sub Button6_Click(sender As Object, e As ImageClickEventArgs)

If myPanel6.Visible = True Then

myPanel6.Visible = False

bjjh.ImageUrl="images/jh_show.gif"

Else

myPanel6.Visible = True

bjjh.ImageUrl="images/jh_hide.gif"

End If

End Sub

Sub Button7_Click(sender As Object, e As ImageClickEventArgs)

If myPanel7.Visible = True Then

myPanel7.Visible = False

bjqt.ImageUrl="images/qt_show.gif"

Else

myPanel7.Visible = True

bjqt.ImageUrl="images/qt_hide.gif"

End If

End Sub

</Script>

<html>

<head>

<title>左边框</title>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<style type="text/css">

<!–

body {

margin-left: 0px;

margin-top: 0px;

margin-right: 0px;

margin-bottom: 0px;

background-color: #CFEFFA;

}

body,td,th {

color: #000066;

}

.style4 {color: #FFFFFF}

a:link {

color: #000066;

text-decoration: none;

}

a:visited {

text-decoration: none;

color: #000066;

}

a:hover {

text-decoration: none;

color: #000066;

}

a:active {

text-decoration: none;

color: #000066;

}

–>

</style></head>

<body>

<Form Runat="Server">

<Asp:ImageButton Runat="Server" Id="sbmr" ImageUrl="images/sb_show.gif" OnClick="Button1_Click" /><br>

<Asp:Panel Runat="Server" Id="myPanel1" HorizontalAlign="Left" Visible = "False">

<table width="150" border="1" cellpadding="0" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#A7D2ED" bgcolor="#CFEFFA">

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center"><a href="sbmr/addsbmr.aspx" target="mainFrame">增加</a></div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">修改</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center"><a href="sbmr/sbmr.aspx" target="mainFrame">查询</a></div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">删除</div></td>

</tr>

</table>

</Asp:Panel>

<Asp:ImageButton Runat="Server" Id="bjmr" ImageUrl="images/bj_show.gif" OnClick="Button2_Click" /><br>

<Asp:Panel Runat="Server" Id="myPanel2" HorizontalAlign="Left" Visible = "False">

<table width="150" border="1" cellpadding="0" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#A7D2ED" bgcolor="#CFEFFA">

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center"><a href="BJMR/add.aspx" target="mainFrame">增加</a></div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center"><a href="bjmr/edit.aspx" target="mainFrame">修改</a></div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center"><a href="BJMR/search.aspx" target="mainFrame">查询</a></div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">删除</div></td>

</tr>

</table>

</asp:panel>

<Asp:ImageButton Runat="Server" Id="bjkc" ImageUrl="images/kc_show.gif" OnClick="Button3_Click" /><br>

<Asp:Panel Runat="Server" Id="myPanel3" HorizontalAlign="Left" Visible = "False">

<table width="150" border="1" cellpadding="0" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#A7D2ED" bgcolor="#CFEFFA">

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center"><a href="BJKC/bjkc.aspx" target="mainFrame">查询</a></div></td>

</tr>

</table>

</asp:panel>

<Asp:ImageButton Runat="Server" Id="bjrk" ImageUrl="images/rk_show.gif" OnClick="Button4_Click" /><br>

<Asp:Panel Runat="Server" Id="myPanel4" HorizontalAlign="Left" Visible = "False">

<table width="150" border="1" cellpadding="0" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#A7D2ED" bgcolor="#CFEFFA">

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">增加</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">修改</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">查询</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">删除</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">统计</div></td>

</tr>

</table>

</asp:panel>

<Asp:ImageButton Runat="Server" Id="bjck" ImageUrl="images/ck_show.gif" OnClick="Button5_Click" /><br>

<Asp:Panel Runat="Server" Id="myPanel5" HorizontalAlign="Left" Visible = "False">

<table width="150" border="1" cellpadding="0" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#A7D2ED" bgcolor="#CFEFFA">

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">增加</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">修改</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">查询</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">删除</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">统计</div></td>

</tr>

</table>

</asp:panel>

<Asp:ImageButton Runat="Server" Id="bjjh" ImageUrl="images/jh_show.gif" OnClick="Button6_Click" /><br>

<Asp:Panel Runat="Server" Id="myPanel6" HorizontalAlign="Left" Visible = "False">

<table width="150" border="1" cellpadding="0" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#A7D2ED" bgcolor="#CFEFFA">

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center"><a href="BJJH/ydjh.aspx" target="mainFrame">应订</a></div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center"><a href="bjjh/yjjh.aspx" target="mainFrame">应交</a></div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center"><a href="bjjh/search.aspx" target="mainFrame">查询</div></a></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">增加</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">删除</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">修改</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">统计</div></td>

</tr>

</table>

</asp:panel>

<Asp:ImageButton Runat="Server" Id="bjqt" ImageUrl="images/qt_show.gif" OnClick="Button7_Click" /><br>

<Asp:Panel Runat="Server" Id="myPanel7" HorizontalAlign="Left" Visible = "False">

<table width="150" border="1" cellpadding="0" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#A7D2ED" bgcolor="#CFEFFA">

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">其他[1]</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">其他[2]</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">其他[3]</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">其他[4]</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">其他[5]</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">其他[6]</div></td>

</tr>

<tr>

<td onmouseout="this.style.backgroundColor=”" onmouseover="this.style.backgroundColor=’#FFcccc’"><div align="center">其他[7]</div></td>

</tr>

</table>

</asp:panel>

</form>

</body>

</html>