home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 5 Developer's Kit / vb5 dev kit.iso / dev / ct_ocx / ct_date.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-01-03  |  14.7 KB  |  494 lines

  1. VERSION 4.00
  2. Begin VB.Form w_date_demo 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "ctDate (Standard Calendar Control) Demo"
  5.    ClientHeight    =   6315
  6.    ClientLeft      =   1215
  7.    ClientTop       =   2010
  8.    ClientWidth     =   8925
  9.    Height          =   6720
  10.    Icon            =   "ct_date.frx":0000
  11.    Left            =   1155
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MDIChild        =   -1  'True
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   6315
  17.    ScaleWidth      =   8925
  18.    ShowInTaskbar   =   0   'False
  19.    Top             =   1665
  20.    Width           =   9045
  21.    Begin VB.TextBox txt_date 
  22.       Height          =   345
  23.       Left            =   6000
  24.       TabIndex        =   21
  25.       Top             =   1380
  26.       Width           =   2115
  27.    End
  28.    Begin VB.CommandButton Command2 
  29.       Caption         =   "E&xit"
  30.       BeginProperty Font 
  31.          name            =   "MS Sans Serif"
  32.          charset         =   0
  33.          weight          =   700
  34.          size            =   8.25
  35.          underline       =   0   'False
  36.          italic          =   0   'False
  37.          strikethrough   =   0   'False
  38.       EndProperty
  39.       Height          =   465
  40.       Left            =   4140
  41.       TabIndex        =   14
  42.       Top             =   5670
  43.       Width           =   1215
  44.    End
  45.    Begin VB.Frame Frame2 
  46.       Caption         =   "Focus Type"
  47.       BeginProperty Font 
  48.          name            =   "MS Sans Serif"
  49.          charset         =   0
  50.          weight          =   700
  51.          size            =   8.25
  52.          underline       =   0   'False
  53.          italic          =   0   'False
  54.          strikethrough   =   0   'False
  55.       EndProperty
  56.       Height          =   1725
  57.       Left            =   4020
  58.       TabIndex        =   9
  59.       Top             =   3600
  60.       Width           =   1455
  61.       Begin VB.OptionButton Option8 
  62.          Caption         =   "Lowered"
  63.          Height          =   285
  64.          Left            =   180
  65.          TabIndex        =   13
  66.          Top             =   1350
  67.          Width           =   975
  68.       End
  69.       Begin VB.OptionButton Option7 
  70.          Caption         =   "Raised"
  71.          Height          =   285
  72.          Left            =   180
  73.          TabIndex        =   12
  74.          Top             =   990
  75.          Width           =   1155
  76.       End
  77.       Begin VB.OptionButton Option6 
  78.          Caption         =   "Fill"
  79.          Height          =   285
  80.          Left            =   180
  81.          TabIndex        =   11
  82.          Top             =   630
  83.          Width           =   1035
  84.       End
  85.       Begin VB.OptionButton Option5 
  86.          Caption         =   "Regular"
  87.          Height          =   285
  88.          Left            =   180
  89.          TabIndex        =   10
  90.          Top             =   270
  91.          Value           =   -1  'True
  92.          Width           =   975
  93.       End
  94.    End
  95.    Begin VB.Frame Frame1 
  96.       Caption         =   "Date Border"
  97.       BeginProperty Font 
  98.          name            =   "MS Sans Serif"
  99.          charset         =   0
  100.          weight          =   700
  101.          size            =   8.25
  102.          underline       =   0   'False
  103.          italic          =   0   'False
  104.          strikethrough   =   0   'False
  105.       EndProperty
  106.       Height          =   1725
  107.       Left            =   4020
  108.       TabIndex        =   4
  109.       Top             =   1530
  110.       Width           =   1455
  111.       Begin VB.OptionButton Option4 
  112.          Caption         =   "Lowered"
  113.          Height          =   255
  114.          Left            =   180
  115.          TabIndex        =   8
  116.          Top             =   1350
  117.          Value           =   -1  'True
  118.          Width           =   1095
  119.       End
  120.       Begin VB.OptionButton Option3 
  121.          Caption         =   "Raised"
  122.          Height          =   255
  123.          Left            =   180
  124.          TabIndex        =   7
  125.          Top             =   990
  126.          Width           =   975
  127.       End
  128.       Begin VB.OptionButton Option2 
  129.          Caption         =   "None"
  130.          Height          =   255
  131.          Left            =   180
  132.          TabIndex        =   6
  133.          Top             =   630
  134.          Width           =   975
  135.       End
  136.       Begin VB.OptionButton Option1 
  137.          Caption         =   "Regular"
  138.          Height          =   255
  139.          Left            =   180
  140.          TabIndex        =   5
  141.          Top             =   270
  142.          Width           =   975
  143.       End
  144.    End
  145.    Begin VB.CommandButton Command1 
  146.       Caption         =   "Today"
  147.       Height          =   375
  148.       Left            =   1380
  149.       TabIndex        =   3
  150.       Top             =   5580
  151.       Width           =   915
  152.    End
  153.    Begin PushLib.ctPush ctPush1 
  154.       Height          =   360
  155.       Left            =   8100
  156.       TabIndex        =   22
  157.       Top             =   1380
  158.       Width           =   315
  159.       _version        =   65536
  160.       _extentx        =   555
  161.       _extenty        =   635
  162.       _stockprops     =   70
  163.       caption         =   "ctPush"
  164.       picture         =   "ct_date.frx":030A
  165.       picposition     =   1
  166.       winstyle        =   0
  167.       bevelsize       =   1
  168.       buttonheight    =   29
  169.       buttonwidth     =   41
  170.       picbevel        =   3
  171.       roundcorners    =   0   'False
  172.       focusborder     =   0   'False
  173.       piconly         =   -1  'True
  174.    End
  175.    Begin VB.Label lbl_button 
  176.       Alignment       =   2  'Center
  177.       Caption         =   "Click on the arrows beside the title to move to a different month."
  178.       BeginProperty Font 
  179.          name            =   "MS Sans Serif"
  180.          charset         =   0
  181.          weight          =   400
  182.          size            =   9.75
  183.          underline       =   0   'False
  184.          italic          =   0   'False
  185.          strikethrough   =   0   'False
  186.       EndProperty
  187.       Height          =   735
  188.       Left            =   6120
  189.       TabIndex        =   19
  190.       Top             =   5130
  191.       Visible         =   0   'False
  192.       Width           =   2235
  193.    End
  194.    Begin DateLib.ctDate ctDate2 
  195.       Height          =   2985
  196.       Left            =   6000
  197.       TabIndex        =   18
  198.       Top             =   1740
  199.       Visible         =   0   'False
  200.       Width           =   2415
  201.       _version        =   65536
  202.       _extentx        =   4260
  203.       _extenty        =   5265
  204.       _stockprops     =   100
  205.       borderstyle     =   1
  206.       bordercolor     =   8421504
  207.       focuscolor      =   12648447
  208.       titlecolor      =   16777215
  209.       levelcolor      =   8421376
  210.       date            =   35065
  211.       day             =   3
  212.       year            =   1996
  213.       action          =   0
  214.       leveloffset     =   0
  215.       datexsize       =   1
  216.       dateysize       =   3
  217.       leveldepth      =   2
  218.       dateborder      =   1
  219.       focustype       =   3
  220.       monthbuttons    =   -1  'True
  221.    End
  222.    Begin VB.Label sle_Date 
  223.       BackColor       =   &H00FFFFFF&
  224.       BorderStyle     =   1  'Fixed Single
  225.       Height          =   345
  226.       Left            =   780
  227.       TabIndex        =   17
  228.       Top             =   1170
  229.       Width           =   2715
  230.    End
  231.    Begin VB.Label Label2 
  232.       Caption         =   "Date :"
  233.       Height          =   285
  234.       Left            =   240
  235.       TabIndex        =   16
  236.       Top             =   1170
  237.       Width           =   555
  238.    End
  239.    Begin VB.Label Label1 
  240.       Alignment       =   2  'Center
  241.       Caption         =   $"ct_date.frx":0554
  242.       BeginProperty Font 
  243.          name            =   "MS Sans Serif"
  244.          charset         =   0
  245.          weight          =   700
  246.          size            =   8.25
  247.          underline       =   0   'False
  248.          italic          =   0   'False
  249.          strikethrough   =   0   'False
  250.       EndProperty
  251.       ForeColor       =   &H00800000&
  252.       Height          =   645
  253.       Left            =   300
  254.       TabIndex        =   15
  255.       Top             =   180
  256.       Width           =   8415
  257.    End
  258.    Begin DataLib.ctData ctData2 
  259.       Height          =   375
  260.       Left            =   2280
  261.       TabIndex        =   2
  262.       Top             =   5580
  263.       Width           =   1185
  264.       _version        =   65536
  265.       _extentx        =   2090
  266.       _extenty        =   661
  267.       _stockprops     =   64
  268.       style           =   1
  269.       arrowsize       =   0
  270.       bevelsize       =   1
  271.    End
  272.    Begin DataLib.ctData ctData1 
  273.       Height          =   375
  274.       Left            =   240
  275.       TabIndex        =   1
  276.       Top             =   5580
  277.       Width           =   1140
  278.       _version        =   65536
  279.       _extentx        =   2011
  280.       _extenty        =   661
  281.       _stockprops     =   64
  282.       arrowsize       =   0
  283.       bevelsize       =   1
  284.    End
  285.    Begin DateLib.ctDate ctDate1 
  286.       Height          =   3735
  287.       Left            =   240
  288.       TabIndex        =   0
  289.       Top             =   1620
  290.       Width           =   3255
  291.       _version        =   65536
  292.       _extentx        =   5741
  293.       _extenty        =   6588
  294.       _stockprops     =   100
  295.       borderstyle     =   1
  296.       bordercolor     =   8421504
  297.       weekendcolor    =   16776960
  298.       titlecolor      =   8388608
  299.       date            =   35065
  300.       day             =   3
  301.       year            =   1996
  302.       action          =   0
  303.       leveloffset     =   0
  304.       datexsize       =   0
  305.       dateysize       =   0
  306.       dateborder      =   3
  307.    End
  308.    Begin VB.Label Label4 
  309.       Alignment       =   2  'Center
  310.       Caption         =   $"ct_date.frx":0670
  311.       BeginProperty Font 
  312.          name            =   "MS Sans Serif"
  313.          charset         =   0
  314.          weight          =   400
  315.          size            =   9.75
  316.          underline       =   0   'False
  317.          italic          =   0   'False
  318.          strikethrough   =   0   'False
  319.       EndProperty
  320.       Height          =   2085
  321.       Left            =   6060
  322.       TabIndex        =   20
  323.       Top             =   2070
  324.       Width           =   2295
  325.    End
  326. Attribute VB_Name = "w_date_demo"
  327. Attribute VB_Creatable = False
  328. Attribute VB_Exposed = False
  329. Private Sub Command1_Click()
  330.    ctDate1.Today
  331. End Sub
  332. Private Sub Command2_Click()
  333.    Unload w_date_demo
  334. End Sub
  335. Private Sub ctData1_ClickCenter()
  336.    ctDate1.LastMonth
  337. End Sub
  338. Private Sub ctData1_ClickLeft()
  339.    ctDate1.LastYear
  340. End Sub
  341. Private Sub ctData1_ClickRight()
  342.    ctDate1.LastDay
  343. End Sub
  344. Private Sub ctData2_ClickCenter()
  345.    ctDate1.NextMonth
  346. End Sub
  347. Private Sub ctData2_ClickLeft()
  348.    ctDate1.NextDay
  349. End Sub
  350. Private Sub ctData2_ClickRight()
  351.    ctDate1.NextYear
  352. End Sub
  353. Private Sub ctDate1_DateChange(nDOW As Integer, nDay As Integer, nMonth As Integer, nYear As Integer)
  354. Dim MonthName As String
  355. Dim nCntr As Integer
  356. If (nMonth = 1) Then
  357.    ctDate1.DayColor(1) = RGB(0, 255, 0)
  358. ElseIf (nMonth = 2) Then
  359.    ctDate1.DayColor(14) = RGB(0, 255, 255)
  360. ElseIf (nMonth = 4) Then
  361.    ctDate1.DayColor(14) = RGB(0, 255, 0)
  362. ElseIf (nMonth = 5) Then
  363.    ctDate1.DayColor(22) = RGB(0, 255, 0)
  364. ElseIf (nMonth = 7) Then
  365.    ctDate1.DayColor(1) = RGB(0, 255, 0)
  366.    ctDate1.DayColor(4) = RGB(0, 255, 0)
  367. ElseIf (nMonth = 9) Then
  368.    ctDate1.DayColor(9) = RGB(0, 255, 0)
  369. ElseIf (nMonth = 10) Then
  370.    For nCntr = 1 To 31
  371.       ctDate1.DayColor(nCntr) = RGB(128 + (nCntr * 4), 128 + (nCntr * 4), 0)
  372.    Next
  373. ElseIf (nMonth = 11) Then
  374.    ctDate1.DayColor(11) = RGB(0, 255, 0)
  375. ElseIf (nMonth = 12) Then
  376.    ctDate1.DayColor(24) = RGB(255, 255, 0)
  377.    ctDate1.DayColor(25) = RGB(0, 255, 0)
  378.    ctDate1.DayColor(26) = RGB(255, 255, 0)
  379. End If
  380. If (nMonth = 1) Then
  381.    MonthName = "Jan."
  382. ElseIf (nMonth = 2) Then
  383.    MonthName = "Feb."
  384. ElseIf (nMonth = 3) Then
  385.    MonthName = "Mar."
  386. ElseIf (nMonth = 4) Then
  387.    MonthName = "Apr."
  388. ElseIf (nMonth = 5) Then
  389.    MonthName = "May"
  390. ElseIf (nMonth = 6) Then
  391.    MonthName = "June"
  392. ElseIf (nMonth = 7) Then
  393.    MonthName = "July"
  394. ElseIf (nMonth = 8) Then
  395.    MonthName = "Aug."
  396. ElseIf (nMonth = 9) Then
  397.    MonthName = "Sep."
  398. ElseIf (nMonth = 10) Then
  399.    MonthName = "Oct."
  400. ElseIf (nMonth = 11) Then
  401.    MonthName = "Nov."
  402. ElseIf (nMonth = 12) Then
  403.    MonthName = "Dec."
  404.    MonthName = "???"
  405. End If
  406. MonthName = MonthName + " " + Str$(nDay) + " / " + Str$(nYear)
  407. If (nDOW = 1) Then
  408.    sle_date.Caption = "Sunday " + MonthName
  409. ElseIf (nDOW = 2) Then
  410.    sle_date.Caption = "Monday " + MonthName
  411. ElseIf (nDOW = 3) Then
  412.    sle_date.Caption = "Tuesday " + MonthName
  413. ElseIf (nDOW = 4) Then
  414.    sle_date.Caption = "Wednesday " + MonthName
  415. ElseIf (nDOW = 5) Then
  416.    sle_date.Caption = "Thursday " + MonthName
  417. ElseIf (nDOW = 6) Then
  418.    sle_date.Caption = "Friday " + MonthName
  419. ElseIf (nDOW = 7) Then
  420.    sle_date.Caption = "Saturday " + MonthName
  421. End If
  422. End Sub
  423. Private Sub ctDate2_DateChange(nDOW As Integer, nDay As Integer, nMonth As Integer, nYear As Integer)
  424.    Dim MonthName As String
  425.    If (nMonth = 1) Then
  426.       MonthName = "January"
  427.    ElseIf (nMonth = 2) Then
  428.       MonthName = "February"
  429.    ElseIf (nMonth = 3) Then
  430.       MonthName = "March"
  431.    ElseIf (nMonth = 4) Then
  432.       MonthName = "April"
  433.    ElseIf (nMonth = 5) Then
  434.       MonthName = "May"
  435.    ElseIf (nMonth = 6) Then
  436.       MonthName = "June"
  437.    ElseIf (nMonth = 7) Then
  438.       MonthName = "July"
  439.    ElseIf (nMonth = 8) Then
  440.       MonthName = "August"
  441.    ElseIf (nMonth = 9) Then
  442.       MonthName = "September"
  443.    ElseIf (nMonth = 10) Then
  444.       MonthName = "October"
  445.    ElseIf (nMonth = 11) Then
  446.       MonthName = "November"
  447.    ElseIf (nMonth = 12) Then
  448.       MonthName = "December"
  449.    Else
  450.       MonthName = "???"
  451.    End If
  452.    MonthName = MonthName + " " + Str$(nDay) + " / " + Str$(nYear)
  453.    txt_date.Text = MonthName
  454. End Sub
  455. Private Sub ctDate2_LostFocus()
  456.    ctDate2.Visible = False
  457.    lbl_button.Visible = False
  458. End Sub
  459. Private Sub ctPush1_Click()
  460.    ctDate2.Visible = True
  461.    lbl_button.Visible = True
  462. End Sub
  463. Private Sub Form_Load()
  464.    ' Center the window on the screen
  465.    Move (Screen.Width - Width) / 2, (Screen.Height - Height) * 0.15
  466.    'w_mdi_main.bt_date = BUTTON_DISABLE
  467.    ctDate1.Today
  468.    ctDate2.Today
  469. End Sub
  470. Private Sub Option1_Click()
  471.    ctDate1.DateBorder = 0
  472. End Sub
  473. Private Sub Option2_Click()
  474.    ctDate1.DateBorder = 1
  475. End Sub
  476. Private Sub Option3_Click()
  477.    ctDate1.DateBorder = 2
  478. End Sub
  479. Private Sub Option4_Click()
  480.    ctDate1.DateBorder = 3
  481. End Sub
  482. Private Sub Option5_Click()
  483.    ctDate1.FocusType = 0
  484. End Sub
  485. Private Sub Option6_Click()
  486.    ctDate1.FocusType = 1
  487. End Sub
  488. Private Sub Option7_Click()
  489.    ctDate1.FocusType = 2
  490. End Sub
  491. Private Sub Option8_Click()
  492.    ctDate1.FocusType = 3
  493. End Sub
  494.