📄 calendarhoroscope.aspx
字号:
<%@ Page Language="C#"%>
<%@ Import Namespace="System.Drawing" %>
<script runat=server>
Random RanNum = new Random( 23 );
void Calendar_RenderDay( object s, DayRenderEventArgs e ) {
TableCell ctlCell;
string strHoroscope = String.Empty;
ctlCell = e.Cell;
switch (RanNum.Next(4))
{
case 0:
strHoroscope = "Good things will happen today!";
ctlCell.BackColor = Color.FromName( "Green" );
break;
case 1:
strHoroscope = "You're doomed! Hide in bed!";
ctlCell.BackColor = Color.FromName( "Red" );
break;
case 2:
strHoroscope = "Something unexpected will happen";
break;
case 3:
strHoroscope = "Look before you leap!";
break;
}
ctlCell.Controls.Add( new LiteralControl( "<p>" ) );
ctlCell.Controls.Add( new LiteralControl( strHoroscope ) );
}
</Script>
<html>
<head><title>CalendarHoroscope.aspx</title></head>
<body>
<h1>Horoscope:</h1>
<form Runat="Server">
<asp:Calendar
Width="100%"
CellPadding="10"
ShowGridLines="True"
SelectionMode="None"
OnDayRender="Calendar_RenderDay"
Runat="Server" />
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -