home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / crystal / extras / vbxdemo / winfrm.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1994-12-15  |  5.7 KB  |  166 lines

  1. VERSION 2.00
  2. Begin Form WinFrm 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Print To Window"
  5.    ClientHeight    =   2190
  6.    ClientLeft      =   1980
  7.    ClientTop       =   2580
  8.    ClientWidth     =   5520
  9.    Height          =   2595
  10.    Left            =   1920
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   2190
  15.    ScaleWidth      =   5520
  16.    Top             =   2235
  17.    Width           =   5640
  18.    Begin CommandButton Command1 
  19.       Caption         =   "Help"
  20.       Height          =   375
  21.       Left            =   3600
  22.       TabIndex        =   6
  23.       Top             =   1530
  24.       Width           =   1185
  25.    End
  26.    Begin SSCheck SavedData 
  27.       Caption         =   "Use Saved Data"
  28.       Font3D          =   0  'None
  29.       Height          =   255
  30.       Left            =   450
  31.       TabIndex        =   2
  32.       Top             =   810
  33.       Width           =   1815
  34.    End
  35.    Begin CommandButton Command3 
  36.       Cancel          =   -1  'True
  37.       Caption         =   "Cancel"
  38.       Height          =   375
  39.       Left            =   2220
  40.       TabIndex        =   5
  41.       Top             =   1530
  42.       Width           =   1215
  43.    End
  44.    Begin CommandButton Command2 
  45.       Caption         =   "Print"
  46.       Default         =   -1  'True
  47.       Height          =   375
  48.       Left            =   840
  49.       TabIndex        =   4
  50.       Top             =   1530
  51.       Width           =   1215
  52.    End
  53.    Begin SSFrame Frame3D1 
  54.       Font3D          =   0  'None
  55.       ForeColor       =   &H00000000&
  56.       Height          =   1005
  57.       Left            =   120
  58.       TabIndex        =   7
  59.       Top             =   225
  60.       Width           =   5295
  61.       Begin SSCheck ShowControls 
  62.          Caption         =   "Show Print Controls"
  63.          Font3D          =   0  'None
  64.          Height          =   195
  65.          Left            =   2220
  66.          TabIndex        =   3
  67.          Top             =   630
  68.          Value           =   -1  'True
  69.          Width           =   2025
  70.       End
  71.       Begin TextBox NDetailCopies 
  72.          Height          =   285
  73.          Left            =   2580
  74.          TabIndex        =   1
  75.          Text            =   "1"
  76.          Top             =   225
  77.          Width           =   615
  78.       End
  79.       Begin Label Label3 
  80.          BackColor       =   &H00C0C0C0&
  81.          Caption         =   "Number of Detail Copies:"
  82.          Height          =   255
  83.          Left            =   360
  84.          TabIndex        =   0
  85.          Top             =   225
  86.          Width           =   2175
  87.       End
  88.    End
  89. Sub Command1_Click ()
  90.    RCode = Shell("Winhelp c:\crw\crw.hlp", 3)
  91. End Sub
  92. Sub Command2_Click ()
  93. 'Declare Variables
  94. 'Dimension a new child form for use with the Crystal Reports
  95. 'Print Window. See the VBXDEMO.TXT for more information
  96.     Dim C As New Child
  97. 'Turn Print Window controls either on or off based on
  98. 'value in 3D Check box.
  99.     If ShowControls.Value = False Then
  100.         Main.Report1.WindowControls = 0
  101.         'If the user does not want print controls then the
  102.         'following command buttons are displayed. They are
  103.         'page scrolling keys which allow you scroll from page to page
  104.         
  105.         
  106.         Main.Command3D17.Visible = True
  107.         Main.Panel3D1.Visible = True
  108.     Else
  109.         Main.Report1.WindowControls = 1
  110.         Main.Command3D17.Visible = False
  111.         Main.Panel3D1.Visible = False
  112.     End If
  113. 'Use the data saved in the report or discard it.
  114.     If SavedData.Enabled = True Then
  115.       Main.Report1.DiscardSavedData = 0
  116.     Else
  117.       Main.Report1.DiscardSavedData = 1
  118.     End If
  119. 'Set number of details copies to be printed. The default is
  120. 'set to 1
  121.     Main.Report1.DetailCopies = NDetailCopies.Text
  122. 'Check to see if the resources are above 20%. If they are then
  123. 'proceed with report printing. If not then ask user to close
  124. 'down a few applications and try again.
  125.      FreeRes = FreeResourcesAreAbove(20)
  126.      If FreeRes = False Then
  127.        MsgBox "Your System Resources are below 20% Free, the job cannot be started! Please exit CRPEDemo, close some of your other Windows applications and try again."
  128.        Exit Sub
  129.      End If
  130. 'Set mouse to an Hour glass
  131.     Screen.MousePointer = 11
  132. 'Set the Title of the MDI Child frame window.
  133.     C.Caption = "MDIChild-VBXDemo"
  134. 'Set the Crystal print window to be a child of the MDI child
  135. 'frame window.
  136.     Main.Report1.WindowParentHandle = C.hWnd
  137. 'Set the destination to Window(0)
  138.     Main.Report1.Destination = 0
  139. 'unload WinFRM before print window appears
  140.     Unload Me
  141. 'Print report to window. If this fails then retrieve the error
  142. 'number and error string and display in a message box. If the call
  143. 'is successful then display the appropriate message in the status
  144. 'bar caption. Notice that the PrintReport property was used
  145. 'so that a Result% was return inorder to do proper error checking
  146.     Main.Arrange Cascade
  147.     If Main.Report1.PrintReport <> 0 Then
  148.       Unload C
  149.       Screen.MousePointer = 0
  150.       MsgBox "Printing the Report to Window has caused Error#: " & Main.Report1.LastErrorNumber & " - " & Main.Report1.LastErrorString
  151.       Exit Sub
  152.     Else
  153.       Main!StatusBar.Caption = "Preview to window Successful."
  154.       'Enable the Close menu item under file inorder to
  155.       'allow the user to close the window from a menu
  156.       'as well as the windows control box
  157.       Main.MenuFileClose.Enabled = True
  158.       'Set the Mouse back to the default(a pointer)
  159.       Screen.MousePointer = 0
  160.     End If
  161.      
  162. End Sub
  163. Sub Command3_Click ()
  164. Unload Me
  165. End Sub
  166.