⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calendarhoroscope.aspx

📁 asp.net技术内幕的书配源码
💻 ASPX
字号:
<%@ Import Namespace="System.Drawing" %>
<Script Runat="Server">

  Dim RanNum As New Random( 23 )

  Sub Calendar_RenderDay( s As Object, e As DayRenderEventArgs )
    Dim ctlCell As TableCell
    Dim strHoroscope As String

    ctlCell = e.Cell

    Select Case RanNum.Next( 4 )
    Case 0
      strHoroscope = "Good things will happen today!"
      ctlCell.BackColor = Color.FromName( "Green" )
    Case 1
      strHoroscope = "You're doomed! Hide in bed!"
      ctlCell.BackColor = Color.FromName( "Red" )
    Case 2
      strHoroscope = "Something unexpected will happen"
    Case 3
      strHoroscope = "Look before you leap!"
    End Select

    ctlCell.Controls.Add( New LiteralControl( "<p>" ) )
    ctlCell.Controls.Add( New LiteralControl( strHoroscope ) )
  End Sub

</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 + -