home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / tool / various / kalend / test5.frm < prev   
Text File  |  1995-02-27  |  5KB  |  185 lines

  1. VERSION 2.00
  2. Begin Form Form5 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Schedule Kalendar"
  6.    ClientHeight    =   4230
  7.    ClientLeft      =   3225
  8.    ClientTop       =   630
  9.    ClientWidth     =   6030
  10.    ForeColor       =   &H00000000&
  11.    Height          =   5160
  12.    Left            =   3165
  13.    LinkTopic       =   "Form5"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   4230
  17.    ScaleWidth      =   6030
  18.    Top             =   -240
  19.    Width           =   6150
  20.    Begin Kalendar Kalendar1 
  21.       BackColor       =   &H00FFFFFF&
  22.       BorderStyle     =   0  'None
  23.       DateDispStyle   =   2  'User
  24.       DayAlignment    =   0  'Upper Left
  25.       DOWAlign        =   2  'Center
  26.       DOWBackColor    =   &H00008000&
  27.       DOWBorder       =   -1  'True
  28.       DOWDispStyle    =   2  'Medium
  29.       DOWFontBold     =   -1  'True
  30.       DOWFontItalic   =   0   'False
  31.       DOWFontName     =   "Arial"
  32.       DOWFontSize     =   10
  33.       DOWFontStrikeThru=   0   'False
  34.       DOWFontUnderline=   0   'False
  35.       DOWForeColor    =   &H00FFFFFF&
  36.       EnableKeys      =   -1  'True
  37.       FirstDOW        =   0  'Sunday
  38.       FixedDayHeight  =   0   'False
  39.       FontBold        =   -1  'True
  40.       FontItalic      =   -1  'True
  41.       FontName        =   "Arial"
  42.       FontSize        =   12
  43.       FontStrikethru  =   0   'False
  44.       FontUnderline   =   0   'False
  45.       ForeColor       =   &H00000000&
  46.       Height          =   4230
  47.       Left            =   30
  48.       LineColor       =   &H00000000&
  49.       MonAlign        =   2  'Center
  50.       MonBackColor    =   &H00FFFFFF&
  51.       MonDispStyle    =   2  'Month/Year
  52.       MonFontBold     =   0   'False
  53.       MonFontItalic   =   0   'False
  54.       MonFontName     =   "Times New Roman"
  55.       MonFontSize     =   14
  56.       MonFontStrikeThru=   0   'False
  57.       MonFontUnderline=   0   'False
  58.       MonForeColor    =   &H00000000&
  59.       OtherMonBackColor=   &H00FFFFFF&
  60.       OtherMonForeColor=   &H00C0C0C0&
  61.       SelDayBackColor =   &H00FF00FF&
  62.       SelDayForeColor =   &H0000FFFF&
  63.       ShowAllDays     =   -1  'True
  64.       ShowArrows      =   -1  'True
  65.       ShowLines       =   -1  'True
  66.       ShowSelection   =   -1  'True
  67.       TabIndex        =   0
  68.       Text            =   "07/02/94"
  69.       Top             =   0
  70.       Width           =   6000
  71.    End
  72.    Begin Menu mnuFile 
  73.       Caption         =   "File"
  74.       Begin Menu mnuFPrint 
  75.          Caption         =   "Print &Portrait"
  76.       End
  77.       Begin Menu mnuFPrintLand 
  78.          Caption         =   "Print &Landscape"
  79.       End
  80.       Begin Menu mnuFPrint3by3 
  81.          Caption         =   "Print 3"" X 3"""
  82.       End
  83.    End
  84. End
  85. Option Explicit
  86.  
  87. Sub Form_Activate ()
  88.     SetDescription Sample5Description()
  89. End Sub
  90.  
  91. Sub Form_Load ()
  92.     Kalendar1.Text = Date
  93. End Sub
  94.  
  95. Sub Form_Resize ()
  96.     Kalendar1.Move 0, 0, Form5.ScaleWidth, Form5.ScaleHeight
  97. End Sub
  98.  
  99. Sub Kalendar1_ClickDay ()
  100. Dim info As DateRange
  101.     If GetDateRangeInfo((Kalendar1.Julian), info) Then
  102.         Form5.Caption = info.Description
  103.     Else
  104.         Form5.Caption = ""
  105.     End If
  106. End Sub
  107.  
  108. Sub Kalendar1_DrawOnDay (hdc As Integer, State As Integer, theDay As Long, x As Single, y As Single, x2 As Single, y2 As Single)
  109. Dim info As DateRange
  110. Dim r As Rect
  111. Dim retval As Variant
  112. Dim oldHBrush As Integer, hBrush As Integer, oldPen As Integer
  113.  
  114.     If GetDateRangeInfo(theDay, info) Then
  115.  
  116.         KalWindowAPIRect x, y, x2, y2, r
  117.  
  118.         If info.StartDate = theDay Then
  119.             r.left = r.left + 20
  120.         End If
  121.         If info.EndDate = theDay Then
  122.             r.right = r.right - 20
  123.         End If
  124.  
  125.         hBrush = CreateSolidBrush(info.color)
  126.         oldHBrush = SelectObject(hdc, hBrush)
  127.         oldPen = SelectObject(hdc, GetStockObject(NULL_PEN))
  128.         
  129.         r.top = r.bottom - 8
  130.         r.bottom = r.bottom - 2
  131.         retval = Rectangle(hdc, r.left, r.top, r.right, r.bottom)
  132.  
  133.         retval = SelectObject(hdc, oldPen)
  134.         retval = SelectObject(hdc, oldHBrush)
  135.         retval = DeleteObject(hBrush)
  136.     End If
  137. End Sub
  138.  
  139. Sub mnuFPrint_Click ()
  140.     Kalendar1.PrintAction = KAL_PRINT_PORTRAIT
  141. End Sub
  142.  
  143. Sub mnuFPrint3by3_Click ()
  144. Dim SaveMonFontSize As Single
  145. Dim saveBackColor As Long
  146.  
  147.     SaveMonFontSize = Kalendar1.MonFontSize
  148.     saveBackColor = Kalendar1.MonBackColor
  149.  
  150.     Kalendar1.MonFontSize = 14
  151.     Kalendar1.MonFontBold = True
  152.     Kalendar1.BorderStyle = 1
  153.     Kalendar1.MonBackColor = RGB(255, 255, 255)
  154.  
  155.     Kalendar1.PrintX = 2880
  156.     Kalendar1.PrintY = 2880
  157.     Kalendar1.PrintWidth = 1440 * 3
  158.     Kalendar1.PrintHeight = 1440 * 3
  159.     Kalendar1.PrintHDC = Printer.hdc
  160.  
  161.     Printer.Print   ' Necessary for VB to send STARTDOC, before printing the Kalendar.
  162.     Kalendar1.PrintAction = KAL_PRINT_USER
  163.  
  164.     Kalendar1.MonFontBold = False
  165.     Kalendar1.MonFontSize = SaveMonFontSize
  166.     Kalendar1.MonBackColor = saveBackColor
  167.     Kalendar1.BorderStyle = 0
  168.  
  169.     Printer.EndDoc
  170. End Sub
  171.  
  172. Sub mnuFPrintLand_Click ()
  173.     Kalendar1.PrintAction = KAL_PRINT_LANDSCAPE
  174. End Sub
  175.  
  176. Function Sample5Description () As String
  177. Dim s As String
  178.  
  179.     s = "One more example of the DrawOnDay event." & CR
  180.     s = s & "You can also print this Kalendar using the three different methods available."
  181.  
  182.     Sample5Description = s
  183. End Function
  184.  
  185.