home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ctdate / ct_date.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-12-05  |  13.0 KB  |  437 lines

  1. VERSION 2.00
  2. Begin Form w_ctdate_demo 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "ctDATE (Monthly Calendar) Demo"
  6.    ClientHeight    =   5550
  7.    ClientLeft      =   570
  8.    ClientTop       =   1335
  9.    ClientWidth     =   8805
  10.    Height          =   5955
  11.    Icon            =   CT_DATE.FRX:0000
  12.    Left            =   510
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   5550
  15.    ScaleWidth      =   8805
  16.    Top             =   990
  17.    Width           =   8925
  18.    Begin TextBox txt_date 
  19.       BackColor       =   &H00FFFFFF&
  20.       FontBold        =   0   'False
  21.       FontItalic      =   0   'False
  22.       FontName        =   "MS Sans Serif"
  23.       FontSize        =   8.25
  24.       FontStrikethru  =   0   'False
  25.       FontUnderline   =   0   'False
  26.       ForeColor       =   &H00000000&
  27.       Height          =   315
  28.       Left            =   5820
  29.       TabIndex        =   18
  30.       Top             =   1380
  31.       Width           =   2355
  32.    End
  33.    Begin PictureBox ctPush1 
  34.       BackColor       =   &H000000FF&
  35.       Height          =   1000
  36.       Left            =   0
  37.       ScaleHeight     =   975
  38.       ScaleWidth      =   975
  39.       TabIndex        =   0
  40.       Top             =   0
  41.       Width           =   1000
  42.    End
  43.    Begin PictureBox ctDate1 
  44.       BackColor       =   &H000000FF&
  45.       Height          =   1000
  46.       Left            =   0
  47.       ScaleHeight     =   975
  48.       ScaleWidth      =   975
  49.       TabIndex        =   3
  50.       Top             =   0
  51.       Width           =   1000
  52.    End
  53.    Begin PictureBox ctGroup2 
  54.       BackColor       =   &H000000FF&
  55.       Height          =   1000
  56.       Left            =   0
  57.       ScaleHeight     =   975
  58.       ScaleWidth      =   975
  59.       TabIndex        =   4
  60.       Top             =   0
  61.       Width           =   1000
  62.       Begin PictureBox ctlw 
  63.          BackColor       =   &H000000FF&
  64.          Height          =   1000
  65.          Left            =   0
  66.          ScaleHeight     =   975
  67.          ScaleWidth      =   975
  68.          TabIndex        =   8
  69.          Top             =   0
  70.          Width           =   1000
  71.       End
  72.       Begin PictureBox ctraise 
  73.          BackColor       =   &H000000FF&
  74.          Height          =   1000
  75.          Left            =   0
  76.          ScaleHeight     =   975
  77.          ScaleWidth      =   975
  78.          TabIndex        =   9
  79.          Top             =   0
  80.          Width           =   1000
  81.       End
  82.       Begin PictureBox ctRadio2 
  83.          BackColor       =   &H000000FF&
  84.          Height          =   1000
  85.          Left            =   0
  86.          ScaleHeight     =   975
  87.          ScaleWidth      =   975
  88.          TabIndex        =   10
  89.          Top             =   0
  90.          Width           =   1000
  91.       End
  92.       Begin PictureBox ctRadio1 
  93.          BackColor       =   &H000000FF&
  94.          Height          =   1000
  95.          Left            =   0
  96.          ScaleHeight     =   975
  97.          ScaleWidth      =   975
  98.          TabIndex        =   11
  99.          Top             =   0
  100.          Width           =   1000
  101.       End
  102.    End
  103.    Begin PictureBox ctGroup1 
  104.       BackColor       =   &H000000FF&
  105.       Height          =   1000
  106.       Left            =   0
  107.       ScaleHeight     =   975
  108.       ScaleWidth      =   975
  109.       TabIndex        =   12
  110.       Top             =   0
  111.       Width           =   1000
  112.       Begin PictureBox ctRadio4 
  113.          BackColor       =   &H000000FF&
  114.          Height          =   1000
  115.          Left            =   0
  116.          ScaleHeight     =   975
  117.          ScaleWidth      =   975
  118.          TabIndex        =   13
  119.          Top             =   0
  120.          Width           =   1000
  121.       End
  122.       Begin PictureBox ctRadio3 
  123.          BackColor       =   &H000000FF&
  124.          Height          =   1000
  125.          Left            =   0
  126.          ScaleHeight     =   975
  127.          ScaleWidth      =   975
  128.          TabIndex        =   14
  129.          Top             =   0
  130.          Width           =   1000
  131.       End
  132.       Begin PictureBox rb_none 
  133.          BackColor       =   &H000000FF&
  134.          Height          =   1000
  135.          Left            =   0
  136.          ScaleHeight     =   975
  137.          ScaleWidth      =   975
  138.          TabIndex        =   15
  139.          Top             =   0
  140.          Width           =   1000
  141.       End
  142.       Begin PictureBox rb_regular 
  143.          BackColor       =   &H000000FF&
  144.          Height          =   1000
  145.          Left            =   0
  146.          ScaleHeight     =   975
  147.          ScaleWidth      =   975
  148.          TabIndex        =   16
  149.          Top             =   0
  150.          Width           =   1000
  151.       End
  152.    End
  153.    Begin CommandButton Command2 
  154.       Caption         =   "Today"
  155.       Height          =   375
  156.       Left            =   1440
  157.       TabIndex        =   5
  158.       Top             =   4980
  159.       Width           =   945
  160.    End
  161.    Begin PictureBox date_next 
  162.       BackColor       =   &H000000FF&
  163.       Height          =   1000
  164.       Left            =   0
  165.       ScaleHeight     =   975
  166.       ScaleWidth      =   975
  167.       TabIndex        =   17
  168.       Top             =   0
  169.       Width           =   1000
  170.    End
  171.    Begin PictureBox date_prev 
  172.       BackColor       =   &H000000FF&
  173.       Height          =   1000
  174.       Left            =   0
  175.       ScaleHeight     =   975
  176.       ScaleWidth      =   975
  177.       TabIndex        =   21
  178.       Top             =   0
  179.       Width           =   1000
  180.    End
  181.    Begin CommandButton Command1 
  182.       Caption         =   "Exit"
  183.       Height          =   375
  184.       Left            =   4320
  185.       TabIndex        =   1
  186.       Top             =   5040
  187.       Width           =   795
  188.    End
  189.    Begin PictureBox ctDate 
  190.       BackColor       =   &H000000FF&
  191.       Height          =   1000
  192.       Left            =   0
  193.       ScaleHeight     =   975
  194.       ScaleWidth      =   975
  195.       TabIndex        =   22
  196.       Top             =   0
  197.       Width           =   1000
  198.    End
  199.    Begin Label lbl_move 
  200.       Alignment       =   2  'Center
  201.       BackColor       =   &H00C0C0C0&
  202.       Caption         =   "Click on the arrows beside the title to move to a different month."
  203.       FontBold        =   0   'False
  204.       FontItalic      =   0   'False
  205.       FontName        =   "MS Sans Serif"
  206.       FontSize        =   9.75
  207.       FontStrikethru  =   0   'False
  208.       FontUnderline   =   0   'False
  209.       ForeColor       =   &H00800000&
  210.       Height          =   675
  211.       Left            =   6090
  212.       TabIndex        =   20
  213.       Top             =   4500
  214.       Visible         =   0   'False
  215.       Width           =   2145
  216.    End
  217.    Begin Label Label3 
  218.       Alignment       =   2  'Center
  219.       BackStyle       =   0  'Transparent
  220.       Caption         =   "The example above uses a label control, picture push button, and a calendar control to simulate a drop down calendar box. Press the button to view the calendar"
  221.       FontBold        =   0   'False
  222.       FontItalic      =   0   'False
  223.       FontName        =   "MS Sans Serif"
  224.       FontSize        =   9.75
  225.       FontStrikethru  =   0   'False
  226.       FontUnderline   =   0   'False
  227.       ForeColor       =   &H00800000&
  228.       Height          =   2175
  229.       Left            =   6060
  230.       TabIndex        =   19
  231.       Top             =   2100
  232.       Width           =   2205
  233.    End
  234.    Begin Label sle_date 
  235.       BackColor       =   &H00FFFFFF&
  236.       BorderStyle     =   1  'Fixed Single
  237.       FontBold        =   0   'False
  238.       FontItalic      =   0   'False
  239.       FontName        =   "MS Sans Serif"
  240.       FontSize        =   8.25
  241.       FontStrikethru  =   0   'False
  242.       FontUnderline   =   0   'False
  243.       Height          =   315
  244.       Left            =   1800
  245.       TabIndex        =   7
  246.       Top             =   1080
  247.       Width           =   2475
  248.    End
  249.    Begin Label Label2 
  250.       BackColor       =   &H00C0C0C0&
  251.       Caption         =   "Date Selected :"
  252.       FontBold        =   0   'False
  253.       FontItalic      =   0   'False
  254.       FontName        =   "MS Sans Serif"
  255.       FontSize        =   9.75
  256.       FontStrikethru  =   0   'False
  257.       FontUnderline   =   0   'False
  258.       Height          =   315
  259.       Left            =   360
  260.       TabIndex        =   6
  261.       Top             =   1080
  262.       Width           =   1455
  263.    End
  264.    Begin Label Label1 
  265.       Alignment       =   2  'Center
  266.       BackColor       =   &H00C0C0C0&
  267.       Caption         =   "ctDATE VBX Is a Calendar Control that allows you to display and select dates in a visual format. The calendar works from 1900 on. Up to five different custom colors can be used to mark the dates. Differnt months or years can be viewed either through an Action attribute of the control, or by using internal controls."
  268.       ForeColor       =   &H00800000&
  269.       Height          =   795
  270.       Left            =   270
  271.       TabIndex        =   2
  272.       Top             =   120
  273.       Width           =   8235
  274.    End
  275. Sub Command1_Click ()
  276.    Unload w_ctdate_demo
  277. End Sub
  278. Sub Command2_Click ()
  279.    ctDate.Action = 7
  280. End Sub
  281. Sub ctDate_DateChange (nDow As Integer, nDay As Integer, nMonth As Integer, nYear As Integer)
  282. Dim MonthName As String
  283. If (nMonth = 1) Then
  284.    ctDate.MarkDate(1) = 2
  285. ElseIf (nMonth = 2) Then
  286.    ctDate.MarkDate(14) = 4
  287. ElseIf (nMonth = 4) Then
  288.    ctDate.MarkDate(14) = 2
  289. ElseIf (nMonth = 5) Then
  290.    ctDate.MarkDate(22) = 2
  291. ElseIf (nMonth = 7) Then
  292.    ctDate.MarkDate(1) = 2
  293.    ctDate.MarkDate(4) = 2
  294. ElseIf (nMonth = 9) Then
  295.    ctDate.MarkDate(9) = 2
  296. ElseIf (nMonth = 10) Then
  297.    ctDate.MarkDate(4) = 2
  298. ElseIf (nMonth = 11) Then
  299.    ctDate.MarkDate(11) = 2
  300. ElseIf (nMonth = 12) Then
  301.    ctDate.MarkDate(24) = 3
  302.    ctDate.MarkDate(25) = 2
  303.    ctDate.MarkDate(26) = 3
  304. End If
  305. If (nMonth = 1) Then
  306.    MonthName = "Jan."
  307. ElseIf (nMonth = 2) Then
  308.    MonthName = "Feb."
  309. ElseIf (nMonth = 3) Then
  310.    MonthName = "Mar."
  311. ElseIf (nMonth = 4) Then
  312.    MonthName = "Apr."
  313. ElseIf (nMonth = 5) Then
  314.    MonthName = "May"
  315. ElseIf (nMonth = 6) Then
  316.    MonthName = "June"
  317. ElseIf (nMonth = 7) Then
  318.    MonthName = "July"
  319. ElseIf (nMonth = 8) Then
  320.    MonthName = "Aug."
  321. ElseIf (nMonth = 9) Then
  322.    MonthName = "Sep."
  323. ElseIf (nMonth = 10) Then
  324.    MonthName = "Oct."
  325. ElseIf (nMonth = 11) Then
  326.    MonthName = "Nov."
  327. ElseIf (nMonth = 12) Then
  328.    MonthName = "Dec."
  329.    MonthName = "???"
  330. End If
  331. MonthName = MonthName + " " + Str$(nDay) + " / " + Str$(nYear)
  332. If (nDow = 1) Then
  333.    sle_date.Caption = "Sunday " + MonthName
  334. ElseIf (nDow = 2) Then
  335.    sle_date.Caption = "Monday " + MonthName
  336. ElseIf (nDow = 3) Then
  337.    sle_date.Caption = "Tuesday " + MonthName
  338. ElseIf (nDow = 4) Then
  339.    sle_date.Caption = "Wednesday " + MonthName
  340. ElseIf (nDow = 5) Then
  341.    sle_date.Caption = "Thursday " + MonthName
  342. ElseIf (nDow = 6) Then
  343.    sle_date.Caption = "Friday " + MonthName
  344. ElseIf (nDow = 7) Then
  345.    sle_date.Caption = "Saturday " + MonthName
  346. End If
  347. End Sub
  348. Sub ctDate1_DateChange (nDow As Integer, nDay As Integer, nMonth As Integer, nYear As Integer)
  349.    Dim MonthName As String
  350.    If (nMonth = 1) Then
  351.       MonthName = "January"
  352.    ElseIf (nMonth = 2) Then
  353.       MonthName = "February"
  354.    ElseIf (nMonth = 3) Then
  355.       MonthName = "March"
  356.    ElseIf (nMonth = 4) Then
  357.       MonthName = "April"
  358.    ElseIf (nMonth = 5) Then
  359.       MonthName = "May"
  360.    ElseIf (nMonth = 6) Then
  361.       MonthName = "June"
  362.    ElseIf (nMonth = 7) Then
  363.       MonthName = "July"
  364.    ElseIf (nMonth = 8) Then
  365.       MonthName = "August"
  366.    ElseIf (nMonth = 9) Then
  367.       MonthName = "September"
  368.    ElseIf (nMonth = 10) Then
  369.       MonthName = "October"
  370.    ElseIf (nMonth = 11) Then
  371.       MonthName = "November"
  372.    ElseIf (nMonth = 12) Then
  373.       MonthName = "December"
  374.    Else
  375.       MonthName = "???"
  376.    End If
  377.    MonthName = MonthName + " " + Str$(nDay) + " / " + Str$(nYear)
  378.    txt_date.Text = MonthName
  379. End Sub
  380. Sub ctDate1_LostFocus ()
  381.    lbl_move.Visible = False
  382.    ctDate1.Visible = False
  383. End Sub
  384. Sub ctlw_Click ()
  385.    ctDate.FocusType = 3
  386. End Sub
  387. Sub ctPush1_Click ()
  388.    lbl_move.Visible = True
  389.    ctDate1.Visible = True
  390.    ctDate1.SetFocus
  391. End Sub
  392. Sub ctRadio1_Click ()
  393.    ctDate.FocusType = 0
  394. End Sub
  395. Sub ctRadio2_Click ()
  396.    ctDate.FocusType = 1
  397. End Sub
  398. Sub ctRadio3_Click ()
  399.    ctDate.DateBorder = 2
  400. End Sub
  401. Sub ctRadio4_Click ()
  402.    ctDate.DateBorder = 3
  403. End Sub
  404. Sub ctraise_Click ()
  405.    ctDate.FocusType = 2
  406. End Sub
  407. Sub date_next_ClickCenter ()
  408.    ctDate.Action = 2
  409. End Sub
  410. Sub date_next_ClickLeft ()
  411.    ctDate.Action = 1
  412. End Sub
  413. Sub date_next_ClickRight ()
  414.    ctDate.Action = 3
  415. End Sub
  416. Sub date_prev_ClickCenter ()
  417.    ctDate.Action = 5
  418. End Sub
  419. Sub date_prev_ClickLeft ()
  420.    ctDate.Action = 6
  421. End Sub
  422. Sub date_prev_ClickRight ()
  423.    ctDate.Action = 4
  424. End Sub
  425. Sub Form_Load ()
  426.    ' Center the window on the screen
  427.    Move (Screen.Width - Width) / 2, (Screen.Height - Height) * .5
  428.    ctDate.Action = 7
  429.    ctDate1.Action = 7
  430. End Sub
  431. Sub rb_none_Click ()
  432.    ctDate.DateBorder = 1
  433. End Sub
  434. Sub rb_regular_Click ()
  435.    ctDate.DateBorder = 0
  436. End Sub
  437.