home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1998 October / DPPCPRO1098.ISO / Ocx / VCFIMP / VCIMPRES.Z / CHSSLink.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-11-01  |  7.9 KB  |  263 lines

  1. VERSION 4.00
  2. Begin VB.MDIForm MDIForm1 
  3.    BackColor       =   &H8000000C&
  4.    Caption         =   "First Impression/Formula One Link Demo"
  5.    ClientHeight    =   6450
  6.    ClientLeft      =   1095
  7.    ClientTop       =   1785
  8.    ClientWidth     =   9435
  9.    Height          =   7200
  10.    Icon            =   "CHSSLink.frx":0000
  11.    Left            =   1005
  12.    LinkTopic       =   "MDIForm1"
  13.    Top             =   1125
  14.    Width           =   9615
  15.    Begin VB.PictureBox Picture1 
  16.       Align           =   1  'Align Top
  17.       Appearance      =   0  'Flat
  18.       BackColor       =   &H00C0C0C0&
  19.       BeginProperty Font 
  20.          name            =   "MS Sans Serif"
  21.          charset         =   0
  22.          weight          =   700
  23.          size            =   8.25
  24.          underline       =   0   'False
  25.          italic          =   0   'False
  26.          strikethrough   =   0   'False
  27.       EndProperty
  28.       ForeColor       =   &H80000008&
  29.       Height          =   615
  30.       Left            =   0
  31.       ScaleHeight     =   585
  32.       ScaleWidth      =   9405
  33.       TabIndex        =   0
  34.       Top             =   0
  35.       Width           =   9435
  36.       Begin VB.CommandButton ChartButton 
  37.          Appearance      =   0  'Flat
  38.          BackColor       =   &H00C0C0C0&
  39.          Caption         =   "Update Sheet"
  40.          BeginProperty Font 
  41.             name            =   "MS Sans Serif"
  42.             charset         =   0
  43.             weight          =   700
  44.             size            =   8.25
  45.             underline       =   0   'False
  46.             italic          =   0   'False
  47.             strikethrough   =   0   'False
  48.          EndProperty
  49.          Height          =   375
  50.          Left            =   7440
  51.          TabIndex        =   3
  52.          Top             =   120
  53.          Visible         =   0   'False
  54.          Width           =   1395
  55.       End
  56.       Begin VB.CheckBox chkChartOnSheet 
  57.          Caption         =   "Place Chart On Sheet"
  58.          BeginProperty Font 
  59.             name            =   "MS Sans Serif"
  60.             charset         =   0
  61.             weight          =   700
  62.             size            =   8.25
  63.             underline       =   0   'False
  64.             italic          =   0   'False
  65.             strikethrough   =   0   'False
  66.          EndProperty
  67.          Height          =   255
  68.          Left            =   4860
  69.          TabIndex        =   2
  70.          Top             =   300
  71.          Width           =   2475
  72.       End
  73.       Begin VB.CheckBox chkLink 
  74.          Caption         =   "Link Chart To Sheet"
  75.          BeginProperty Font 
  76.             name            =   "MS Sans Serif"
  77.             charset         =   0
  78.             weight          =   700
  79.             size            =   8.25
  80.             underline       =   0   'False
  81.             italic          =   0   'False
  82.             strikethrough   =   0   'False
  83.          EndProperty
  84.          Height          =   195
  85.          Left            =   4860
  86.          TabIndex        =   1
  87.          Top             =   60
  88.          Width           =   2175
  89.       End
  90.    End
  91.    Begin MSComDlg.CommonDialog CommonDialog1 
  92.       Left            =   60
  93.       Top             =   660
  94.       _Version        =   65536
  95.       _ExtentX        =   847
  96.       _ExtentY        =   847
  97.       _StockProps     =   0
  98.    End
  99.    Begin VB.Menu mnuFile 
  100.       Caption         =   "&File"
  101.       Begin VB.Menu mnuFileLoadChart 
  102.          Caption         =   "Load &Chart..."
  103.       End
  104.       Begin VB.Menu mnuFileLoadWorkbook 
  105.          Caption         =   "Load &Workbook..."
  106.       End
  107.       Begin VB.Menu FileSep 
  108.          Caption         =   "-"
  109.       End
  110.       Begin VB.Menu FileExit 
  111.          Caption         =   "E&xit"
  112.       End
  113.    End
  114.    Begin VB.Menu mnuChart 
  115.       Caption         =   "&Chart"
  116.       Begin VB.Menu mnuChart2DBar 
  117.          Caption         =   "2D Bar Chart"
  118.       End
  119.       Begin VB.Menu mnuChart3DBar 
  120.          Caption         =   "3D Bar Chart"
  121.       End
  122.       Begin VB.Menu mnuChart2DPie 
  123.          Caption         =   "2D Pie Chart"
  124.       End
  125.       Begin VB.Menu mnuChart3DPie 
  126.          Caption         =   "3D Pie Chart"
  127.       End
  128.    End
  129.    Begin VB.Menu Window 
  130.       Caption         =   "&Window"
  131.       Begin VB.Menu mnuWindowCascade 
  132.          Caption         =   "&Cascade"
  133.       End
  134.       Begin VB.Menu mnuWindowHor 
  135.          Caption         =   "Tile &Horizontal"
  136.       End
  137.       Begin VB.Menu mnuWindowVert 
  138.          Caption         =   "Tile &Vertical"
  139.       End
  140.       Begin VB.Menu mnuWindowIcons 
  141.          Caption         =   "&Arrange Icons"
  142.       End
  143.    End
  144. Attribute VB_Name = "MDIForm1"
  145. Attribute VB_Creatable = False
  146. Attribute VB_Exposed = False
  147. Option Explicit
  148. Private Sub ChartButton_Click()
  149.    ' If there is a chart on the sheet then update the chart
  150.    If chkChartOnSheet.Value = 1 Then
  151.       Call MoveChartPictureToSheet
  152.    End If
  153. End Sub
  154. Private Sub FileExit_Click()
  155.    End
  156. End Sub
  157. Private Sub chkLink_Click()
  158.    If chkLink.Value = 1 Then
  159.       Call ResizeArea
  160.    Else
  161.       ' Disconnect the two
  162.       ChartForm.VtChart1.SsLinkMode = VtChSsLinkModeOff
  163.    End If
  164. End Sub
  165. Private Sub MDIForm_Load()
  166.    Top = 0
  167.    Left = 0
  168.    Width = 9615
  169.    Height = 7200
  170.    ChartForm.Show
  171.    SheetForm.Show
  172.    Arrange 2
  173.    GlobalObjID = 0
  174. End Sub
  175. Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  176.    End
  177. End Sub
  178. Private Sub mnuChart2DBar_Click()
  179.    ChartForm.VtChart1.ChartType = VtChChartType2dBar
  180.    Call ClearChartMenuChecks
  181.    mnuChart2DBar.Checked = True
  182. End Sub
  183. Private Sub mnuChart2DPie_Click()
  184.    ChartForm.VtChart1.ChartType = VtChChartType2dPie
  185.    Call ClearChartMenuChecks
  186.    mnuChart2DPie.Checked = True
  187. End Sub
  188. Private Sub mnuChart3DBar_Click()
  189.    ChartForm.VtChart1.ChartType = VtChChartType3dBar
  190.    Call ClearChartMenuChecks
  191.    mnuChart3DBar.Checked = True
  192. End Sub
  193. Private Sub mnuChart3DPie_Click()
  194.    ChartForm.VtChart1.ChartType = VtChChartType3dPie
  195.    Call ClearChartMenuChecks
  196.    mnuChart3DPie.Checked = True
  197. End Sub
  198. Private Sub mnuFileLoadChart_Click()
  199.    On Error GoTo FIFileLoadError
  200.    With CommonDialog1
  201.       .DialogTitle = "Read First Impression Chart"
  202.       .DefaultExt = "vtc"
  203.       .Filter = "FirstImpression Charts |*.vtc"
  204.       .Flags = &H1000
  205.       .InitDir = App.Path
  206.       .ShowOpen
  207.       ChartForm.VtChart1.ReadFromFile (.fileName)
  208.    End With
  209.    Exit Sub
  210. FIFileLoadError:
  211.    MsgBox Error
  212. End Sub
  213. Private Sub mnuFileLoadWorkbook_Click()
  214.    On Error GoTo F1FileLoadError
  215.    Dim fileName As String
  216.    SheetForm.F1Book1.OpenFileDlg "Formula One Link Demo", hWnd, fileName
  217.    SheetForm.F1Book1.ReadFile = fileName
  218.    SheetForm.F1Book1.TableName = fileName
  219.    Exit Sub
  220. F1FileLoadError:
  221.    MsgBox Error
  222. End Sub
  223. Private Sub mnuWindowCascade_Click()
  224.    Arrange 0
  225. End Sub
  226. Private Sub mnuWindowHor_Click()
  227.    Arrange 1
  228. End Sub
  229. Private Sub mnuWindowIcons_Click()
  230.    Arrange 3
  231. End Sub
  232. Private Sub mnuWindowVert_Click()
  233.    Arrange 2
  234. End Sub
  235. Private Sub chkChartOnSheet_Click()
  236. #If Win32 Then
  237.    Dim metafile&
  238. #Else
  239.    Dim metafile%
  240. #End If
  241.    Dim MapMode%, ObjID&
  242.    Dim X1!, Y1!, X2!, Y2!
  243.    Dim ExtentX&, ExtentY&
  244.    ChartButton.Visible = chkChartOnSheet.Value
  245.    If chkChartOnSheet.Value = 1 Then
  246.       ' Cell coordinates of where to put the chart
  247.       X1 = 1
  248.       Y1 = 6
  249.       X2 = 5
  250.       Y2 = 18
  251.       MapMode = 8 ' Anisotropic Mode (Stretchable)
  252.       ' Get the metafile from the chart
  253.       ChartForm.VtChart1.GetMetafile VtPictureOptionNoSizeHeader, metafile, ExtentX, ExtentY
  254.       ' Place it on the spreadsheet
  255.       SheetForm.F1Book1.ObjNewPicture X1, Y1, X2, Y2, ObjID, metafile, MapMode, ExtentX, ExtentY
  256.       GlobalObjID = ObjID
  257.    Else
  258.       ' Delete the chart metafile object
  259.       SheetForm.F1Book1.ObjSetSelection GlobalObjID
  260.       SheetForm.F1Book1.EditCut
  261.    End If
  262. End Sub
  263.