home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / tool / various / kalend / test.frm < prev    next >
Text File  |  1995-02-27  |  12KB  |  400 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Kalendar Settings"
  6.    ClientHeight    =   4095
  7.    ClientLeft      =   3195
  8.    ClientTop       =   345
  9.    ClientWidth     =   6375
  10.    Height          =   4620
  11.    Left            =   3135
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   4095
  14.    ScaleWidth      =   6375
  15.    Top             =   -120
  16.    Width           =   6495
  17.    Begin ComboBox cmbDOWAlignment 
  18.       BackColor       =   &H00FFFFFF&
  19.       Height          =   300
  20.       Left            =   4440
  21.       Style           =   2  'Dropdown List
  22.       TabIndex        =   13
  23.       Top             =   3225
  24.       Width           =   1845
  25.    End
  26.    Begin ComboBox cmbHeadingAlign 
  27.       BackColor       =   &H00FFFFFF&
  28.       Height          =   300
  29.       Left            =   4440
  30.       Style           =   2  'Dropdown List
  31.       TabIndex        =   11
  32.       Top             =   2685
  33.       Width           =   1845
  34.    End
  35.    Begin CheckBox chkShowAllDays 
  36.       BackColor       =   &H00C0C0C0&
  37.       Caption         =   "Show All Days"
  38.       Height          =   225
  39.       Left            =   4440
  40.       TabIndex        =   10
  41.       Top             =   3825
  42.       Width           =   1815
  43.    End
  44.    Begin CheckBox chkFixed 
  45.       BackColor       =   &H00C0C0C0&
  46.       Caption         =   "Fixed Day Height"
  47.       Height          =   225
  48.       Left            =   4440
  49.       TabIndex        =   8
  50.       Top             =   3570
  51.       Width           =   1815
  52.    End
  53.    Begin ComboBox cmbAlignment 
  54.       BackColor       =   &H00FFFFFF&
  55.       Height          =   300
  56.       Left            =   4440
  57.       Style           =   2  'Dropdown List
  58.       TabIndex        =   7
  59.       Top             =   2175
  60.       Width           =   1845
  61.    End
  62.    Begin ComboBox cmbFirstDOW 
  63.       BackColor       =   &H00FFFFFF&
  64.       Height          =   300
  65.       Left            =   4440
  66.       Style           =   2  'Dropdown List
  67.       TabIndex        =   4
  68.       Top             =   1635
  69.       Width           =   1845
  70.    End
  71.    Begin ComboBox cmbStyle 
  72.       BackColor       =   &H00FFFFFF&
  73.       Height          =   300
  74.       Left            =   4440
  75.       Style           =   2  'Dropdown List
  76.       TabIndex        =   2
  77.       Top             =   1095
  78.       Width           =   1845
  79.    End
  80.    Begin Kalendar Kalendar1 
  81.       BackColor       =   &H00FFFFFF&
  82.       BorderStyle     =   1  'Fixed Single
  83.       DateDispStyle   =   0  'Normal
  84.       DayAlignment    =   8  'Bottom Right
  85.       DOWAlign        =   2  'Center
  86.       DOWBackColor    =   &H00C0C0C0&
  87.       DOWBorder       =   -1  'True
  88.       DOWDispStyle    =   2  'Medium
  89.       DOWFontBold     =   -1  'True
  90.       DOWFontItalic   =   0   'False
  91.       DOWFontName     =   "MS Sans Serif"
  92.       DOWFontSize     =   8.25
  93.       DOWFontStrikeThru=   0   'False
  94.       DOWFontUnderline=   0   'False
  95.       DOWForeColor    =   &H00000000&
  96.       EnableKeys      =   -1  'True
  97.       FirstDOW        =   0  'Sunday
  98.       FixedDayHeight  =   0   'False
  99.       ForeColor       =   &H00000000&
  100.       Height          =   3645
  101.       Left            =   0
  102.       LineColor       =   &H00000000&
  103.       MonAlign        =   0  'Left
  104.       MonBackColor    =   &H00C0C0C0&
  105.       MonDispStyle    =   2  'Month/Year
  106.       MonFontBold     =   -1  'True
  107.       MonFontItalic   =   0   'False
  108.       MonFontName     =   "Arial"
  109.       MonFontSize     =   12
  110.       MonFontStrikeThru=   0   'False
  111.       MonFontUnderline=   0   'False
  112.       MonForeColor    =   &H00000000&
  113.       OtherMonBackColor=   &H00C0C0C0&
  114.       OtherMonForeColor=   &H00FFFFFF&
  115.       SelDayBackColor =   &H00C0C0C0&
  116.       SelDayForeColor =   &H00000000&
  117.       ShowAllDays     =   0   'False
  118.       ShowArrows      =   -1  'True
  119.       ShowLines       =   -1  'True
  120.       ShowSelection   =   -1  'True
  121.       TabIndex        =   0
  122.       TabStop         =   0   'False
  123.       Text            =   "06/11/94"
  124.       Top             =   360
  125.       Width           =   4230
  126.    End
  127.    Begin Label Label7 
  128.       BackColor       =   &H00C0C0C0&
  129.       Caption         =   "DOW Alignment"
  130.       Height          =   195
  131.       Left            =   4440
  132.       TabIndex        =   14
  133.       Top             =   3030
  134.       Width           =   1350
  135.    End
  136.    Begin Label Label1 
  137.       Alignment       =   2  'Center
  138.       AutoSize        =   -1  'True
  139.       BackColor       =   &H00C0C0C0&
  140.       Caption         =   "Label1"
  141.       FontBold        =   0   'False
  142.       FontItalic      =   0   'False
  143.       FontName        =   "Arial"
  144.       FontSize        =   13.5
  145.       FontStrikethru  =   0   'False
  146.       FontUnderline   =   0   'False
  147.       ForeColor       =   &H00000000&
  148.       Height          =   315
  149.       Left            =   0
  150.       TabIndex        =   1
  151.       Top             =   0
  152.       Width           =   4245
  153.    End
  154.    Begin Label Label6 
  155.       BackColor       =   &H00C0C0C0&
  156.       Caption         =   "Month Alignment"
  157.       Height          =   195
  158.       Left            =   4440
  159.       TabIndex        =   12
  160.       Top             =   2505
  161.       Width           =   1425
  162.    End
  163.    Begin Label Label5 
  164.       Alignment       =   2  'Center
  165.       BackColor       =   &H00FFFF00&
  166.       BorderStyle     =   1  'Fixed Single
  167.       Caption         =   "Here is just a sampling of the properties that Kalendar provides."
  168.       Height          =   855
  169.       Left            =   4440
  170.       TabIndex        =   9
  171.       Top             =   -15
  172.       Width           =   1830
  173.    End
  174.    Begin Label Label4 
  175.       BackColor       =   &H00C0C0C0&
  176.       Caption         =   "Day Alignment"
  177.       Height          =   195
  178.       Left            =   4440
  179.       TabIndex        =   6
  180.       Top             =   1980
  181.       Width           =   1230
  182.    End
  183.    Begin Label Label3 
  184.       BackColor       =   &H00C0C0C0&
  185.       Caption         =   "First Day of Week"
  186.       Height          =   195
  187.       Left            =   4440
  188.       TabIndex        =   5
  189.       Top             =   1455
  190.       Width           =   1545
  191.    End
  192.    Begin Label Label2 
  193.       BackColor       =   &H00C0C0C0&
  194.       Caption         =   "Display Style"
  195.       Height          =   195
  196.       Left            =   4440
  197.       TabIndex        =   3
  198.       Top             =   885
  199.       Width           =   1110
  200.    End
  201. End
  202.  
  203. Option Explicit
  204.  
  205. Dim lastScroll As Integer
  206.  
  207. Sub chkFixed_Click ()
  208.     Kalendar1.FixedDayHeight = chkFixed.Value
  209. End Sub
  210.  
  211. Sub chkShowAllDays_Click ()
  212.     Kalendar1.ShowAllDays = chkShowAllDays.Value
  213. End Sub
  214.  
  215. Sub cmbAlignment_Click ()
  216.     Kalendar1.DayAlignment = cmbAlignment.ListIndex
  217. End Sub
  218.  
  219. Sub cmbDOWAlignment_Click ()
  220.     Kalendar1.DOWAlign = cmbDOWAlignment.ListIndex
  221. End Sub
  222.  
  223. Sub cmbFirstDOW_Click ()
  224.     Kalendar1.FirstDOW = cmbFirstDOW.ListIndex
  225. End Sub
  226.  
  227. Sub cmbHeadingAlign_Click ()
  228.     Kalendar1.MonAlign = cmbHeadingAlign.ListIndex
  229. End Sub
  230.  
  231. Sub cmbStyle_Click ()
  232.  
  233.     If cmbStyle.ListIndex = 0 Then
  234.         ' Get back the original colors.
  235.         Kalendar1.BackColor = RGB(255, 255, 255)
  236.         Kalendar1.ForeColor = 0
  237.         Kalendar1.SelDayBackColor = RGB(192, 192, 192)
  238.         Kalendar1.SelDayForeColor = 0
  239.         Kalendar1.LineColor = 0
  240.     End If
  241.     Kalendar1.DateDispStyle = cmbStyle.ListIndex
  242. End Sub
  243.  
  244. Sub Command1_Click ()
  245.     Form3.Show
  246. End Sub
  247.  
  248. Sub Command2_Click ()
  249.     Form2.Show
  250. End Sub
  251.  
  252. Sub Form_Activate ()
  253.     SetDescription Sample1Description()
  254. End Sub
  255.  
  256. Sub Form_DblClick ()
  257.     'Form2.Show 1
  258. End Sub
  259.  
  260. Sub Form_Load ()
  261. Dim i As Integer
  262.     lastScroll = 0
  263.  
  264.     Kalendar1.Text = Date
  265.  
  266.     SetUpCombos
  267.  
  268. End Sub
  269.  
  270. Sub Kalendar1_ClickDay ()
  271.     Label1.Caption = "Date: " & Kalendar1.Text
  272. End Sub
  273.  
  274. Sub Kalendar1_DblClickDay ()
  275.     MsgBox "A Double Click! " & Kalendar1.Text
  276. End Sub
  277.  
  278. Sub Kalendar1_DragDrop (Source As Control, x As Single, y As Single)
  279. Dim tmpDay As String
  280.  
  281.     Kalendar1.PointX = x
  282.     Kalendar1.PointY = y
  283.  
  284.     tmpDay = Kalendar1.DateAtPoint
  285.     If tmpDay <> "" Then
  286.         Kalendar1.Text = Kalendar1.DateAtPoint
  287.         MsgBox "You dropped " & Source.Caption
  288.     End If
  289. End Sub
  290.  
  291. Sub Kalendar1_DragOver (Source As Control, x As Single, y As Single, State As Integer)
  292. Dim tmpDay As String
  293.     Kalendar1.PointX = x
  294.     Kalendar1.PointY = y
  295.  
  296.     tmpDay = Kalendar1.DateAtPoint
  297.     If tmpDay <> "" Then
  298.         Kalendar1.Text = Kalendar1.DateAtPoint
  299.     End If
  300. End Sub
  301.  
  302. Sub Kalendar1_DrawDay (hdc As Integer, State As Integer, theDay As Long, x As Single, y As Single, x2 As Single, y2 As Single, Cancel As Integer)
  303. Dim DOW As Integer
  304.  
  305.     DOW = Format(theDay, "w")
  306.  
  307.     Select Case State
  308.         Case KAL_STATE_NOT_SELECTED:
  309.             If DOW = 1 Or DOW = 7 Then
  310.                 Kalendar1.BackColor = RGB(128, 0, 128)
  311.             Else
  312.                 Kalendar1.BackColor = RGB(255, 0, 255)
  313.                 Kalendar1.LineColor = RGB(255, 0, 255)
  314.             End If
  315.     
  316.         Case KAL_STATE_SELECTED_WITH, KAL_STATE_SELECTED_WITHOUT:
  317.             If DOW = 1 Or DOW = 7 Then
  318.                 Kalendar1.SelDayBackColor = RGB(255, 0, 0)
  319.                 Kalendar1.LineColor = RGB(255, 0, 0)
  320.             Else
  321.                 Kalendar1.SelDayBackColor = RGB(192, 0, 0)
  322.                 Kalendar1.LineColor = RGB(192, 0, 0)
  323.             End If
  324.  
  325.         Case KAL_STATE_OTHERMONTH:
  326.             If DOW = 1 Or DOW = 7 Then
  327.                 Kalendar1.OtherMonBackColor = RGB(128, 0, 128)
  328.             Else
  329.                 Kalendar1.OtherMonBackColor = RGB(255, 0, 255)
  330.             End If
  331.     End Select
  332.  
  333.     If DOW = 1 Or DOW = 7 Then
  334.         Kalendar1.DayAlignment = 8
  335.         Kalendar1.LineColor = RGB(0, 255, 0)
  336.         Kalendar1.ForeColor = RGB(255, 255, 255)
  337.     Else
  338.         Kalendar1.DayAlignment = 0
  339.         Kalendar1.LineColor = RGB(0, 255, 255)
  340.         Kalendar1.ForeColor = RGB(0, 0, 0)
  341.     End If
  342.  
  343. End Sub
  344.  
  345. Function Sample1Description () As String
  346. Dim CR As String
  347. Dim s As String
  348.  
  349.     s = "This sample highlights some of the flexibilty of a Kalendar."
  350.     s = s & "The most interesting property is the Display Style (DayDispStyle), by setting this property you can: " & CR
  351.     s = s & "   1) Let the custom control draw itself based on the selected properties. (Ho hum)" & CR
  352.     s = s & "   2) Let the custom control draw the day boxes like 3-D buttons. (Yipee)" & CR
  353.     s = s & "   3) Draw the day boxes yourself. (Cool!)"
  354.     s = s & "When you select the user defined drawing method (number 3), you have several options for affecting how a day box is drawn. "
  355.     s = s & "This sample simply changes the background color of a day and the day alignment based on the day of the week. "
  356.     s = s & "Other samples in this demo show how you can draw on top of each day box, or even draw the entire day box itself."
  357.  
  358.     Sample1Description = s
  359. End Function
  360.  
  361. Sub SetUpCombos ()
  362.     cmbStyle.AddItem "Normal"
  363.     cmbStyle.AddItem "3D"
  364.     cmbStyle.AddItem "User-Defined"
  365.  
  366.     cmbStyle.ListIndex = 0
  367.  
  368.     cmbFirstDOW.AddItem "Sunday"
  369.     cmbFirstDOW.AddItem "Monday"
  370.     cmbFirstDOW.AddItem "Tuesday"
  371.     cmbFirstDOW.AddItem "Wednesday"
  372.     cmbFirstDOW.AddItem "Thursday"
  373.     cmbFirstDOW.AddItem "Friday"
  374.     cmbFirstDOW.AddItem "Saturday"
  375.     cmbFirstDOW.ListIndex = 0
  376.  
  377.     cmbAlignment.AddItem "Upper Left"
  378.     cmbAlignment.AddItem "Upper Center"
  379.     cmbAlignment.AddItem "Upper Right"
  380.     cmbAlignment.AddItem "Mid Left"
  381.     cmbAlignment.AddItem "Mid Center"
  382.     cmbAlignment.AddItem "Mid Right"
  383.     cmbAlignment.AddItem "Lower Left"
  384.     cmbAlignment.AddItem "Lower Center"
  385.     cmbAlignment.AddItem "Lower Right"
  386.     cmbAlignment.ListIndex = 0
  387.  
  388.     cmbHeadingAlign.AddItem "Left"
  389.     cmbHeadingAlign.AddItem "Right"
  390.     cmbHeadingAlign.AddItem "Center"
  391.     cmbHeadingAlign.ListIndex = 2
  392.  
  393.     cmbDOWAlignment.AddItem "Left"
  394.     cmbDOWAlignment.AddItem "Right"
  395.     cmbDOWAlignment.AddItem "Center"
  396.     cmbDOWAlignment.ListIndex = 2
  397.  
  398. End Sub
  399.  
  400.