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

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "First Impression Drag 'n Drop Formatting Example"
  4.    ClientHeight    =   7290
  5.    ClientLeft      =   1215
  6.    ClientTop       =   1890
  7.    ClientWidth     =   9465
  8.    Height          =   8040
  9.    Icon            =   "DragDrop.frx":0000
  10.    Left            =   1125
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   7290
  13.    ScaleWidth      =   9465
  14.    Top             =   1230
  15.    Width           =   9645
  16.    Begin Threed.SSPanel pnlControls 
  17.       Height          =   1575
  18.       Left            =   60
  19.       TabIndex        =   1
  20.       Top             =   60
  21.       Width           =   9315
  22.       _Version        =   65536
  23.       _ExtentX        =   16431
  24.       _ExtentY        =   2778
  25.       _StockProps     =   15
  26.       BackColor       =   12632256
  27.       BevelOuter      =   1
  28.       Begin VB.ComboBox cboChartType 
  29.          Height          =   300
  30.          Left            =   6180
  31.          Style           =   2  'Dropdown List
  32.          TabIndex        =   40
  33.          Top             =   360
  34.          Width           =   1755
  35.       End
  36.       Begin VB.ComboBox cboLineSize 
  37.          Height          =   300
  38.          Left            =   8220
  39.          Style           =   2  'Dropdown List
  40.          TabIndex        =   36
  41.          Top             =   360
  42.          Width           =   855
  43.       End
  44.       Begin VB.ComboBox cboFontSize 
  45.          Height          =   300
  46.          Left            =   8220
  47.          Style           =   2  'Dropdown List
  48.          TabIndex        =   35
  49.          Top             =   1080
  50.          Width           =   855
  51.       End
  52.       Begin VB.ComboBox cboFontName 
  53.          Height          =   300
  54.          Left            =   6180
  55.          Sorted          =   -1  'True
  56.          Style           =   2  'Dropdown List
  57.          TabIndex        =   34
  58.          Top             =   1080
  59.          Width           =   1755
  60.       End
  61.       Begin VB.Frame Frame2 
  62.          Caption         =   " Draggable Objects "
  63.          ForeColor       =   &H00C00000&
  64.          Height          =   1335
  65.          Left            =   180
  66.          TabIndex        =   8
  67.          Top             =   120
  68.          Width           =   2595
  69.          Begin VB.PictureBox pctColors 
  70.             DragMode        =   1  'Automatic
  71.             Height          =   135
  72.             Index           =   8
  73.             Left            =   180
  74.             ScaleHeight     =   105
  75.             ScaleWidth      =   1125
  76.             TabIndex        =   24
  77.             Top             =   1020
  78.             Width           =   1155
  79.          End
  80.          Begin VB.PictureBox pctColors 
  81.             DragMode        =   1  'Automatic
  82.             Height          =   255
  83.             Index           =   7
  84.             Left            =   1080
  85.             ScaleHeight     =   225
  86.             ScaleWidth      =   225
  87.             TabIndex        =   23
  88.             Top             =   720
  89.             Width           =   255
  90.          End
  91.          Begin VB.PictureBox pctColors 
  92.             DragMode        =   1  'Automatic
  93.             Height          =   255
  94.             Index           =   6
  95.             Left            =   780
  96.             ScaleHeight     =   225
  97.             ScaleWidth      =   225
  98.             TabIndex        =   22
  99.             Top             =   720
  100.             Width           =   255
  101.          End
  102.          Begin VB.PictureBox pctColors 
  103.             DragMode        =   1  'Automatic
  104.             Height          =   255
  105.             Index           =   5
  106.             Left            =   480
  107.             ScaleHeight     =   225
  108.             ScaleWidth      =   225
  109.             TabIndex        =   21
  110.             Top             =   720
  111.             Width           =   255
  112.          End
  113.          Begin VB.PictureBox pctColors 
  114.             DragMode        =   1  'Automatic
  115.             Height          =   255
  116.             Index           =   4
  117.             Left            =   180
  118.             ScaleHeight     =   225
  119.             ScaleWidth      =   225
  120.             TabIndex        =   20
  121.             Top             =   720
  122.             Width           =   255
  123.          End
  124.          Begin VB.PictureBox pctColors 
  125.             DragMode        =   1  'Automatic
  126.             Height          =   255
  127.             Index           =   3
  128.             Left            =   1080
  129.             ScaleHeight     =   225
  130.             ScaleWidth      =   225
  131.             TabIndex        =   19
  132.             Top             =   420
  133.             Width           =   255
  134.          End
  135.          Begin VB.PictureBox pctColors 
  136.             DragMode        =   1  'Automatic
  137.             Height          =   255
  138.             Index           =   2
  139.             Left            =   780
  140.             ScaleHeight     =   225
  141.             ScaleWidth      =   225
  142.             TabIndex        =   18
  143.             Top             =   420
  144.             Width           =   255
  145.          End
  146.          Begin VB.PictureBox pctColors 
  147.             DragMode        =   1  'Automatic
  148.             Height          =   255
  149.             Index           =   1
  150.             Left            =   480
  151.             ScaleHeight     =   225
  152.             ScaleWidth      =   225
  153.             TabIndex        =   17
  154.             Top             =   420
  155.             Width           =   255
  156.          End
  157.          Begin VB.PictureBox pctColors 
  158.             DragMode        =   1  'Automatic
  159.             Height          =   255
  160.             Index           =   0
  161.             Left            =   180
  162.             ScaleHeight     =   225
  163.             ScaleWidth      =   225
  164.             TabIndex        =   16
  165.             Top             =   420
  166.             Width           =   255
  167.          End
  168.          Begin VB.PictureBox pctImage 
  169.             BackColor       =   &H00FFFFFF&
  170.             DragMode        =   1  'Automatic
  171.             Height          =   255
  172.             Index           =   0
  173.             Left            =   1560
  174.             Picture         =   "DragDrop.frx":030A
  175.             ScaleHeight     =   225
  176.             ScaleWidth      =   225
  177.             TabIndex        =   15
  178.             Tag             =   "Pictures"
  179.             Top             =   420
  180.             Width           =   255
  181.          End
  182.          Begin VB.PictureBox pctImage 
  183.             BackColor       =   &H00FFFFFF&
  184.             DragMode        =   1  'Automatic
  185.             Height          =   255
  186.             Index           =   1
  187.             Left            =   1860
  188.             Picture         =   "DragDrop.frx":1FD6
  189.             ScaleHeight     =   225
  190.             ScaleWidth      =   225
  191.             TabIndex        =   14
  192.             Tag             =   "Pictures"
  193.             Top             =   420
  194.             Width           =   255
  195.          End
  196.          Begin VB.PictureBox pctImage 
  197.             BackColor       =   &H00FFFFFF&
  198.             DragMode        =   1  'Automatic
  199.             Height          =   255
  200.             Index           =   2
  201.             Left            =   2160
  202.             Picture         =   "DragDrop.frx":A1B0
  203.             ScaleHeight     =   225
  204.             ScaleWidth      =   225
  205.             TabIndex        =   13
  206.             Tag             =   "Pictures"
  207.             Top             =   420
  208.             Width           =   255
  209.          End
  210.          Begin VB.PictureBox pctImage 
  211.             BackColor       =   &H00FFFFFF&
  212.             DragMode        =   1  'Automatic
  213.             Height          =   255
  214.             Index           =   3
  215.             Left            =   1560
  216.             Picture         =   "DragDrop.frx":100A8
  217.             ScaleHeight     =   225
  218.             ScaleWidth      =   225
  219.             TabIndex        =   12
  220.             Tag             =   "Pictures"
  221.             Top             =   720
  222.             Width           =   255
  223.          End
  224.          Begin VB.PictureBox pctImage 
  225.             BackColor       =   &H00FFFFFF&
  226.             DragMode        =   1  'Automatic
  227.             Height          =   255
  228.             Index           =   4
  229.             Left            =   1860
  230.             Picture         =   "DragDrop.frx":1096C
  231.             ScaleHeight     =   225
  232.             ScaleWidth      =   225
  233.             TabIndex        =   11
  234.             Tag             =   "Pictures"
  235.             Top             =   720
  236.             Width           =   255
  237.          End
  238.          Begin VB.PictureBox pctImage 
  239.             BackColor       =   &H00FFFFFF&
  240.             DragMode        =   1  'Automatic
  241.             Height          =   255
  242.             Index           =   5
  243.             Left            =   2160
  244.             Picture         =   "DragDrop.frx":1106E
  245.             ScaleHeight     =   225
  246.             ScaleWidth      =   225
  247.             TabIndex        =   10
  248.             Tag             =   "Pictures"
  249.             Top             =   720
  250.             Width           =   255
  251.          End
  252.          Begin VB.PictureBox pctImage 
  253.             BackColor       =   &H00FFFFFF&
  254.             DragMode        =   1  'Automatic
  255.             Height          =   135
  256.             Index           =   6
  257.             Left            =   1560
  258.             ScaleHeight     =   105
  259.             ScaleWidth      =   825
  260.             TabIndex        =   9
  261.             Tag             =   "Pictures"
  262.             Top             =   1020
  263.             Width           =   855
  264.          End
  265.       End
  266.       Begin VB.Frame Frame1 
  267.          Caption         =   " Show: "
  268.          ForeColor       =   &H00C00000&
  269.          Height          =   1335
  270.          Left            =   4380
  271.          TabIndex        =   3
  272.          Top             =   120
  273.          Width           =   1515
  274.          Begin Threed.SSCheck chkPointLabels 
  275.             Height          =   255
  276.             Left            =   180
  277.             TabIndex        =   7
  278.             Top             =   240
  279.             Width           =   1215
  280.             _Version        =   65536
  281.             _ExtentX        =   2143
  282.             _ExtentY        =   450
  283.             _StockProps     =   78
  284.             Caption         =   "Point Labels"
  285.             ForeColor       =   12582912
  286.          End
  287.          Begin Threed.SSCheck chkAxisTitles 
  288.             Height          =   255
  289.             Left            =   180
  290.             TabIndex        =   6
  291.             Top             =   720
  292.             Width           =   1215
  293.             _Version        =   65536
  294.             _ExtentX        =   2143
  295.             _ExtentY        =   450
  296.             _StockProps     =   78
  297.             Caption         =   "Axis Titles"
  298.             ForeColor       =   12582912
  299.          End
  300.          Begin Threed.SSCheck chkSeriesLabels 
  301.             Height          =   255
  302.             Left            =   180
  303.             TabIndex        =   5
  304.             Top             =   480
  305.             Width           =   1215
  306.             _Version        =   65536
  307.             _ExtentX        =   2143
  308.             _ExtentY        =   450
  309.             _StockProps     =   78
  310.             Caption         =   "Series Labels"
  311.             ForeColor       =   12582912
  312.          End
  313.          Begin Threed.SSCheck chkLegend 
  314.             Height          =   255
  315.             Left            =   180
  316.             TabIndex        =   4
  317.             Top             =   960
  318.             Width           =   1215
  319.             _Version        =   65536
  320.             _ExtentX        =   2143
  321.             _ExtentY        =   450
  322.             _StockProps     =   78
  323.             Caption         =   "Legend"
  324.             ForeColor       =   12582912
  325.             Value           =   -1  'True
  326.          End
  327.       End
  328.       Begin VB.Frame Frame3 
  329.          Caption         =   " Light Source "
  330.          ForeColor       =   &H00C00000&
  331.          Height          =   1335
  332.          Left            =   3000
  333.          TabIndex        =   2
  334.          Top             =   120
  335.          Width           =   1155
  336.          Begin VB.OptionButton optLight 
  337.             Height          =   255
  338.             Index           =   8
  339.             Left            =   780
  340.             TabIndex        =   33
  341.             Top             =   900
  342.             Width           =   195
  343.          End
  344.          Begin VB.OptionButton optLight 
  345.             Height          =   255
  346.             Index           =   7
  347.             Left            =   480
  348.             TabIndex        =   32
  349.             Top             =   900
  350.             Width           =   195
  351.          End
  352.          Begin VB.OptionButton optLight 
  353.             Height          =   255
  354.             Index           =   6
  355.             Left            =   180
  356.             TabIndex        =   31
  357.             Top             =   900
  358.             Width           =   195
  359.          End
  360.          Begin VB.OptionButton optLight 
  361.             Height          =   255
  362.             Index           =   5
  363.             Left            =   780
  364.             TabIndex        =   30
  365.             Top             =   600
  366.             Width           =   195
  367.          End
  368.          Begin VB.OptionButton optLight 
  369.             Height          =   255
  370.             Index           =   4
  371.             Left            =   480
  372.             TabIndex        =   29
  373.             Top             =   600
  374.             Width           =   195
  375.          End
  376.          Begin VB.OptionButton optLight 
  377.             Height          =   255
  378.             Index           =   3
  379.             Left            =   180
  380.             TabIndex        =   28
  381.             Top             =   600
  382.             Width           =   195
  383.          End
  384.          Begin VB.OptionButton optLight 
  385.             Height          =   255
  386.             Index           =   2
  387.             Left            =   780
  388.             TabIndex        =   27
  389.             Top             =   300
  390.             Width           =   195
  391.          End
  392.          Begin VB.OptionButton optLight 
  393.             Height          =   255
  394.             Index           =   1
  395.             Left            =   480
  396.             TabIndex        =   26
  397.             Top             =   300
  398.             Width           =   195
  399.          End
  400.          Begin VB.OptionButton optLight 
  401.             Height          =   255
  402.             Index           =   0
  403.             Left            =   180
  404.             TabIndex        =   25
  405.             Top             =   300
  406.             Value           =   -1  'True
  407.             Width           =   195
  408.          End
  409.       End
  410.       Begin VB.Label Label1 
  411.          Caption         =   "Chart Type"
  412.          ForeColor       =   &H00C00000&
  413.          Height          =   195
  414.          Index           =   0
  415.          Left            =   6180
  416.          TabIndex        =   41
  417.          Top             =   120
  418.          Width           =   840
  419.       End
  420.       Begin VB.Label Label1 
  421.          Caption         =   "Font Size"
  422.          ForeColor       =   &H00C00000&
  423.          Height          =   195
  424.          Index           =   3
  425.          Left            =   8220
  426.          TabIndex        =   39
  427.          Top             =   840
  428.          Width           =   840
  429.       End
  430.       Begin VB.Label Label1 
  431.          Caption         =   "Line Size"
  432.          ForeColor       =   &H00C00000&
  433.          Height          =   195
  434.          Index           =   2
  435.          Left            =   8220
  436.          TabIndex        =   38
  437.          Top             =   120
  438.          Width           =   840
  439.       End
  440.       Begin VB.Label Label1 
  441.          Caption         =   "Font Name"
  442.          ForeColor       =   &H00C00000&
  443.          Height          =   195
  444.          Index           =   1
  445.          Left            =   6180
  446.          TabIndex        =   37
  447.          Top             =   840
  448.          Width           =   840
  449.       End
  450.    End
  451.    Begin MSComDlg.CommonDialog CommonDialog1 
  452.       Left            =   8700
  453.       Top             =   1800
  454.       _Version        =   65536
  455.       _ExtentX        =   847
  456.       _ExtentY        =   847
  457.       _StockProps     =   0
  458.       CancelError     =   -1  'True
  459.    End
  460.    Begin VCIFiLib.VtChart VtChart1 
  461.       Height          =   5475
  462.       Left            =   60
  463.       TabIndex        =   0
  464.       Top             =   1740
  465.       Width           =   9315
  466.       _version        =   65536
  467.       _extentx        =   16431
  468.       _extenty        =   9657
  469.       _stockprops     =   96
  470.       filename        =   "DragDrop.frx":11770
  471.    End
  472.    Begin VB.Menu mnuFile 
  473.       Caption         =   "&File"
  474.       Begin VB.Menu FileRead 
  475.          Caption         =   "&Read Chart"
  476.       End
  477.       Begin VB.Menu FileWrite 
  478.          Caption         =   "&Write Chart"
  479.       End
  480.       Begin VB.Menu fileSep0 
  481.          Caption         =   "-"
  482.       End
  483.       Begin VB.Menu mnuWriteMeta 
  484.          Caption         =   "Write &Metafile"
  485.       End
  486.       Begin VB.Menu mnuWriteBitmap 
  487.          Caption         =   "Write &Bitmap"
  488.       End
  489.       Begin VB.Menu fileSep1 
  490.          Caption         =   "-"
  491.       End
  492.       Begin VB.Menu mnuFileExit 
  493.          Caption         =   "E&xit"
  494.       End
  495.    End
  496.    Begin VB.Menu mnuAbout 
  497.       Caption         =   "&About"
  498.    End
  499. Attribute VB_Name = "Form1"
  500. Attribute VB_Creatable = False
  501. Attribute VB_Exposed = False
  502. Option Explicit
  503. Dim gfiPartSelected%, gfiAxisID%, gfiSeriesID%, gfiDataPointID%
  504. Private Sub GetFontAndSize(chartPart%)
  505.    '' Puts the font name and size of the selected part in
  506.    '' the respective combo boxes
  507.    Dim i%, fSize!, fName$
  508.    Dim part As Object
  509.    With VtChart1
  510.       Select Case chartPart
  511.          Case VtChPartTypeTitle
  512.             Set part = .Title.VtFont
  513.          Case VtChPartTypeFootnote
  514.             Set part = .Footnote.VtFont
  515.          Case VtChPartTypeLegend
  516.             Set part = .Legend.VtFont
  517.          Case VtChPartTypeSeriesLabel
  518.             Set part = .Plot.SeriesCollection.Item(gfiSeriesID).SeriesLabel.VtFont
  519.          Case VtChPartTypePointLabel
  520.             Set part = .Plot.SeriesCollection.Item(gfiSeriesID).DataPoints.Item(gfiDataPointID).DataPointLabel.VtFont
  521.          Case VtChPartTypeAxis
  522.             Set part = .Plot.Axis(gfiAxisID).Labels.Item(1).VtFont
  523.          Case VtChPartTypeAxisTitle
  524.             Set part = .Plot.Axis(gfiAxisID).AxisTitle.VtFont
  525.          Case Else
  526.           '' N/A VtChPartTypeChart, VtChPartTypePlot, VtChPartTypeSeries, VtChPartTypePoint
  527.             cboFontName.ListIndex = -1
  528.             cboFontSize.ListIndex = -1
  529.             Exit Sub
  530.       End Select
  531.    End With
  532.    Let fName = part.Name
  533.    fSize = part.size
  534.    For i = 0 To cboFontName.ListCount - 1
  535.       If StrComp(fName, cboFontName.List(i)) = 0 Then
  536.          cboFontName.ListIndex = i
  537.          Exit For
  538.       End If
  539.    Next i
  540.    For i = 0 To cboFontSize.ListCount - 1
  541.       If fSize = Val(cboFontSize.List(i)) Then
  542.          cboFontSize.ListIndex = i
  543.          Exit For
  544.       End If
  545.    Next i
  546. End Sub
  547. Sub GetLineSize(chartPart%)
  548.    Dim part As Object
  549.    Dim size!, i%
  550.    size = Val(cboLineSize.Text)
  551.    With VtChart1
  552.       Select Case chartPart
  553.          Case VtChPartTypeChart
  554.             Set part = .Backdrop.Frame
  555.          Case VtChPartTypeTitle
  556.             Set part = .Title.Backdrop.Frame
  557.          Case VtChPartTypeFootnote
  558.             Set part = .Footnote.Backdrop.Frame
  559.          Case VtChPartTypeLegend
  560.             Set part = .Legend.Backdrop.Frame
  561.          Case VtChPartTypePlot
  562.             Set part = .Plot.Backdrop.Frame
  563.          Case VtChPartTypeSeries
  564.             Set part = .Plot.SeriesCollection.Item(gfiSeriesID).Pen
  565.          Case VtChPartTypeSeriesLabel
  566.             Set part = .Plot.SeriesCollection.Item(gfiSeriesID).SeriesLabel.Backdrop.Frame
  567.          Case VtChPartTypePoint
  568.             Set part = .Plot.SeriesCollection.Item(gfiSeriesID).DataPoints.Item(gfiDataPointID).EdgePen
  569.          Case VtChPartTypePointLabel
  570.             Set part = .Plot.SeriesCollection.Item(gfiSeriesID).DataPoints.Item(gfiDataPointID).DataPointLabel.Backdrop.Frame
  571.          Case VtChPartTypeAxis
  572.             Set part = .Plot.Axis(gfiAxisID).AxisGrid.MajorPen
  573.          Case VtChPartTypeAxisLabel
  574.             Set part = .Plot.Axis(gfiAxisID).Labels.Item(1).Backdrop.Frame
  575.          Case VtChPartTypeAxisTitle
  576.             Set part = .Plot.Axis(gfiAxisID).AxisTitle.Backdrop.Frame
  577.          Case Else
  578.             cboLineSize.ListIndex = -1
  579.             Exit Sub
  580.      End Select
  581.    End With
  582.    size = part.Width
  583.    For i = 0 To cboLineSize.ListCount - 1
  584.       If size = Val(cboLineSize.List(i)) Then
  585.          cboLineSize.ListIndex = i
  586.          Exit For
  587.       End If
  588.    Next i
  589. End Sub
  590. Private Sub SetDefaults()
  591.    With VtChart1
  592.       .Repaint = False         ' supress repaint during changes
  593.       .Plot.AutoLayout = True
  594.       With .Title
  595.          .Text = "First Impression Demo"
  596.          .VtFont.size = 12
  597.          .VtFont.VtColor.Set 0, 0, 255
  598.       End With
  599.       
  600.       With .Footnote
  601.          .Text = "Visual Components, Inc."
  602.          .VtFont.size = 8
  603.          .VtFont.VtColor.Set 0, 0, 255
  604.       End With
  605.       
  606.       With .Legend
  607.          .Location.LocationType = VtChLocationTypeRight
  608.          .Backdrop.Frame.Style = VtFrameStyleSingleLine
  609.          .Backdrop.Fill.VtPicture.filename = ""
  610.       End With
  611.       .Left = pnlControls.Left
  612.       .Top = pnlControls.Top + pnlControls.Height + 75
  613.       .Width = ScaleWidth - .Left - 150
  614.       .Height = ScaleHeight - .Top - 150
  615.       .Repaint = True          ' allow the chart to update
  616.    End With
  617. End Sub
  618. Sub SetLighting(Index%)
  619.    '' Lights are numbered top to bottom, left to right, from
  620.    '' 0 to 8. These are considered infinite light sources
  621.    '' that form a vector from their location to the origin.
  622.    Dim x&, y&, z&
  623.    '' Set the lighting according to the chosen option
  624.    '' The x, y, and z values form a ray from the origin
  625.    '' You can set the angle by adjusting the z magnitude
  626.    z = 20
  627.    Select Case Index
  628.       Case 0 ' Top Left
  629.          x = 10
  630.          y = -10
  631.       Case 1 ' Top Center
  632.          x = 0
  633.          y = -10
  634.       Case 2 ' Top Right
  635.          x = -10
  636.          y = -10
  637.       Case 3 ' Middle Left
  638.          x = 10
  639.          y = 0
  640.       Case 4 ' Middle Center
  641.          x = 0
  642.          y = 0
  643.       Case 5 ' Middle Right
  644.          x = -10
  645.          y = 0
  646.       Case 6 ' Bottom Left
  647.          x = 10
  648.          y = 10
  649.       Case 7 ' Bottom Middle
  650.          x = 0
  651.          y = 10
  652.       Case 8 ' Bottom Right
  653.          x = -10
  654.          y = 10
  655.    End Select
  656.    ' Default is one light - we modify that one
  657.    With VtChart1.Plot.Light.LightSources.Item(1)
  658.        .x = x
  659.        .y = y
  660.        .z = z
  661.    End With
  662.            
  663. End Sub
  664. Private Sub cboFontName_Click()
  665.    '' Test to see if the font is different so we don't
  666.    '' lay the chart out needlessly. We use a global
  667.    '' gfiPartSelected to indicate which part is selected since
  668.    '' this will be called if the combo selection is changed as
  669.    '' a result of a chart selected event. The selected event
  670.    '' happens before the chart stores the new chart part selected
  671.    '' so there is no way to get it until after the event clears
  672.    Dim dataPoint As Object, chartPart As Object
  673.    Dim fName$
  674.    With VtChart1
  675.       Select Case gfiPartSelected
  676.          Case VtChPartTypeTitle
  677.             Set chartPart = .Title.VtFont
  678.          Case VtChPartTypeFootnote
  679.             Set chartPart = .Footnote.VtFont
  680.          Case VtChPartTypeLegend
  681.             Set chartPart = .Legend.VtFont
  682.          Case VtChPartTypeSeriesLabel
  683.             Set chartPart = .Plot.SeriesCollection.Item(gfiSeriesID).SeriesLabel.VtFont
  684.          Case VtChPartTypePointLabel
  685.             Set chartPart = .Plot.SeriesCollection.Item(gfiSeriesID).DataPoints.Item(gfiDataPointID).DataPointLabel.VtFont
  686.          Case VtChPartTypeAxis
  687.             Set chartPart = .Plot.Axis(gfiAxisID).Labels.Item(1).VtFont
  688.          Case VtChPartTypeAxisTitle
  689.             Set chartPart = .Plot.Axis(gfiAxisID).AxisTitle.VtFont
  690.          Case Else
  691.           '' N/A VtChPartTypeChart, VtChPartTypePlot, VtChPartTypeSeries, VtChPartTypePoint
  692.             cboFontName.ListIndex = -1
  693.             Exit Sub
  694.       End Select
  695.       
  696.       Let fName = cboFontName.Text
  697.       If StrComp(chartPart.Name, fName) <> 0 Then
  698.          chartPart.Name = fName
  699.       End If
  700.    End With
  701. End Sub
  702. Private Sub cboFontSize_Click()
  703.    Dim dataPoint As Object, chartPart As Object
  704.    Dim fSize!
  705.    With VtChart1
  706.       Select Case gfiPartSelected
  707.          Case VtChPartTypeTitle
  708.             Set chartPart = .Title.VtFont
  709.          Case VtChPartTypeFootnote
  710.             Set chartPart = .Footnote.VtFont
  711.          Case VtChPartTypeLegend
  712.             Set chartPart = .Legend.VtFont
  713.          Case VtChPartTypeSeriesLabel
  714.             Set chartPart = .Plot.SeriesCollection.Item(gfiSeriesID).SeriesLabel.VtFont
  715.          Case VtChPartTypePointLabel
  716.             Set chartPart = .Plot.SeriesCollection.Item(gfiSeriesID).DataPoints.Item(gfiDataPointID).DataPointLabel.VtFont
  717.          Case VtChPartTypeAxis
  718.             Set chartPart = .Plot.Axis(gfiAxisID).Labels.Item(1).VtFont
  719.          Case VtChPartTypeAxisTitle
  720.             Set chartPart = .Plot.Axis(gfiAxisID).AxisTitle.VtFont
  721.          Case Else
  722.           '' N/A VtChPartTypeChart, VtChPartTypePlot, VtChPartTypeSeries, VtChPartTypePoint
  723.             cboFontSize.ListIndex = -1
  724.             Exit Sub
  725.       End Select
  726.       
  727.       fSize = Val(cboFontSize.Text)
  728.       If chartPart.size <> fSize Then
  729.          chartPart.size = fSize
  730.       End If
  731.    End With
  732. End Sub
  733. Private Sub cboLineSize_Click()
  734.    Dim size!, fStyle%, part As Object
  735.    size = Val(cboLineSize.Text)
  736.    fStyle = IIf(size = 0, VtFrameStyleNull, VtFrameStyleSingleLine)
  737.    With VtChart1
  738.       Select Case gfiPartSelected
  739.          Case VtChPartTypeChart
  740.             Set part = .Backdrop.Frame
  741.             .Backdrop.Frame.Style = fStyle
  742.          Case VtChPartTypeTitle
  743.             Set part = .Title.Backdrop.Frame
  744.             .Title.Backdrop.Frame.Style = fStyle
  745.          Case VtChPartTypeFootnote
  746.             Set part = .Footnote.Backdrop.Frame
  747.             .Footnote.Backdrop.Frame.Style = fStyle
  748.          Case VtChPartTypeLegend
  749.             Set part = .Legend.Backdrop.Frame
  750.             .Legend.Backdrop.Frame.Style = fStyle
  751.          Case VtChPartTypePlot
  752.             Set part = .Plot.Backdrop.Frame
  753.             .Plot.Backdrop.Frame.Style = fStyle
  754.          Case VtChPartTypeSeries
  755.             Set part = .Plot.SeriesCollection.Item(gfiSeriesID).Pen
  756.             .Plot.SeriesCollection.Item(gfiSeriesID).Pen.Style = VtPenStyleSolid
  757.          Case VtChPartTypeSeriesLabel
  758.             Set part = .Plot.SeriesCollection.Item(gfiSeriesID).SeriesLabel.Backdrop.Frame
  759.             .Plot.SeriesCollection.Item(gfiSeriesID).SeriesLabel.Backdrop.Frame.Style = fStyle
  760.          Case VtChPartTypePoint
  761.             Set part = .Plot.SeriesCollection.Item(gfiSeriesID).DataPoints.Item(gfiDataPointID).EdgePen
  762.             .Plot.SeriesCollection.Item(gfiSeriesID).DataPoints.Item(gfiDataPointID).EdgePen.Style = VtPenStyleSolid
  763.          Case VtChPartTypePointLabel
  764.             Set part = .Plot.SeriesCollection.Item(gfiSeriesID).DataPoints.Item(gfiDataPointID).DataPointLabel.Backdrop.Frame
  765.             .Plot.SeriesCollection.Item(gfiSeriesID).DataPoints.Item(gfiDataPointID).DataPointLabel.Backdrop.Frame.Style = fStyle
  766.          Case VtChPartTypeAxis
  767.             Set part = .Plot.Axis(gfiAxisID).AxisGrid.MajorPen
  768.             .Plot.Axis(gfiAxisID).AxisGrid.MajorPen.Style = VtPenStyleSolid
  769.          Case VtChPartTypeAxisLabel
  770.             Set part = .Plot.Axis(gfiAxisID).Labels.Item(1).Backdrop.Frame
  771.             .Plot.Axis(gfiAxisID).Labels.Item(1).Backdrop.Frame.Style = fStyle
  772.          Case VtChPartTypeAxisTitle
  773.             Set part = .Plot.Axis(gfiAxisID).AxisTitle.Backdrop.Frame
  774.             .Plot.Axis(gfiAxisID).AxisTitle.Backdrop.Frame.Style = fStyle
  775.          Case Else
  776.             cboLineSize.ListIndex = -1
  777.             Exit Sub
  778.      End Select
  779.    End With
  780.    If size <> part.Width Then
  781.       part.Width = size
  782.    End If
  783. End Sub
  784. Sub FileRead_Click()
  785.    Dim TheFileName$
  786.    On Error GoTo FileReadErr
  787.    With CommonDialog1
  788.       .DialogTitle = "Read First Impression Chart"
  789.       .DefaultExt = "vtc"                 'Set default extention to vtc
  790.       .Filter = "FirstImpression Charts |*.vtc"
  791.       .Flags = &H1000
  792.       .InitDir = App.Path                 'Set the default dir to app dir
  793.       .ShowOpen
  794.       VtChart1.ReadFromFile (.filename)   'Read in the chart that is selected
  795.    End With
  796.    Exit Sub
  797. FileReadErr:
  798.    MsgBox Error
  799. End Sub
  800. Sub FileWrite_Click()
  801.    On Error GoTo FileReadErr
  802.    With CommonDialog1
  803.       .DialogTitle = "Write First Impression Chart"
  804.       .DefaultExt = "vtc"
  805.       .Filter = "First Impression Charts (*.vtc)|*.vtc"
  806.       .Flags = &H2
  807.       .InitDir = App.Path
  808.       .ShowSave
  809.       VtChart1.WriteToFile (.filename)
  810.    End With
  811.    Exit Sub
  812. FileReadErr:
  813.    MsgBox Error
  814. End Sub
  815. Private Sub chkLegend_Click(Value As Integer)
  816.    VtChart1.Legend.Location.LocationType = VtChLocationTypeRight
  817.    VtChart1.Legend.Location.Visible = Value
  818. End Sub
  819. Private Sub chkPointLabels_Click(Value As Integer)
  820.    Dim series As Object, dataPoint As Object
  821.    For Each series In VtChart1.Plot.SeriesCollection
  822.       For Each dataPoint In series.DataPoints
  823.          With dataPoint.DataPointLabel
  824.             If Not Value Then
  825.                .LocationType = VtChLabelLocationTypeNone
  826.             Else
  827.                .VtFont.size = 8
  828.                .VtFont.VtColor.Set 0, 0, 255
  829.                .LocationType = VtChLabelLocationTypeAbovePoint
  830.             End If
  831.          End With
  832.       Next dataPoint
  833.    Next series
  834. End Sub
  835. Private Sub chkAxisTitles_Click(Value As Integer)
  836.    With VtChart1.Plot
  837.       .Axis(VtChAxisIdX).AxisTitle.Visible = Value    'Set the Axis Visible toggle
  838.       .Axis(VtChAxisIdY).AxisTitle.Visible = Value    'According to the current
  839.       .Axis(VtChAxisIdY2).AxisTitle.Visible = Value   'value in the check box
  840.       .Axis(VtChAxisIdZ).AxisTitle.Visible = Value
  841.    End With
  842. End Sub
  843. Private Sub chkSeriesLabels_Click(Value As Integer)
  844.    ' Toggles series labels on and off
  845.    Dim series As Object
  846.      
  847.    For Each series In VtChart1.Plot.SeriesCollection
  848.       With series.SeriesLabel
  849.          If Not Value Then
  850.             .LocationType = VtChLabelLocationTypeNone
  851.          Else
  852.             .LocationType = VtChLabelLocationTypeRight
  853.             .LineStyle = VtChLabelLineStyleNone
  854.             .VtFont.size = 8
  855.             .VtFont.VtColor.Set 0, 0, 255
  856.             With .Backdrop
  857.                .Frame.Style = VtFrameStyleSingleLine
  858.                .Frame.FrameColor.Set 0, 0, 0
  859.                With .Fill
  860.                   .Style = VtFillStyleBrush
  861.                   .Brush.Style = VtBrushStyleSolid
  862.                   .Brush.FillColor.Set 255, 255, 255
  863.                End With
  864.             End With
  865.          End If
  866.       End With
  867.    Next series
  868. End Sub
  869. Private Sub cboChartType_Click()
  870.    Dim a&
  871.    '' Not all series labels can be shown
  872.    a = cboChartType.ItemData(cboChartType.ListIndex)
  873.    chkSeriesLabels.Enabled = ((a > 1 And a < 8) Or a = 14)
  874.    VtChart1.ChartType = a
  875. End Sub
  876. Private Sub Form_Load()
  877.    Dim i%
  878.    ' Size and position the form
  879.    Top = 0
  880.    Left = 0
  881.    Height = 7200
  882.    Width = 9615
  883.    SetDefaults
  884.    With VtChart1
  885.       ' Set the chart size
  886.       .RowCount = 4
  887.       .ColumnCount = 4
  888.        
  889.       ' Set Column Labels
  890.       .Column = 1
  891.       .ColumnLabel = "Under 3000'"
  892.       .Column = 2
  893.       .ColumnLabel = "3000' - 6000'"
  894.       .Column = 3
  895.       .ColumnLabel = "6000' - 9000'"
  896.       .Column = 4
  897.       .ColumnLabel = "Over 9000'"
  898.       'Set the Row Labels
  899.       .Row = 1
  900.       .RowLabel = "Winter"
  901.       .Row = 2
  902.       .RowLabel = "Spring"
  903.       .Row = 3
  904.       .RowLabel = "Summer"
  905.       .Row = 4
  906.       .RowLabel = "Fall"
  907.      
  908.       ' Fill the Chart with random data
  909.       .DataGrid.RandomDataFill
  910.       .Legend.Location.Visible = True  'Set the Legend to be visible and
  911.       chkLegend.Value = True            'Mark the Check Box
  912.       With .Plot
  913.          ' Set the width for a more pleasing view
  914.          .WidthToHeightRatio = 2
  915.          .DepthToHeightRatio = 2
  916.           
  917.          ' Set Axis titles
  918.          .Axis(VtChAxisIdX, 1).AxisTitle.Text = "Season"
  919.          .Axis(VtChAxisIdY, 1).AxisTitle.Text = "Precipitation" + Chr$(10) + "(inches)"
  920.          .Axis(VtChAxisIdY2, 1).AxisTitle.Text = "Precipitation" + Chr$(10) + "(inches)"
  921.          .Axis(VtChAxisIdZ, 1).AxisTitle.Text = "(thousand feet)" + Chr$(10) + "Elevation"
  922.       End With
  923.    End With
  924.    ' Fill Combination Chart List Box
  925.    With cboChartType
  926.       .AddItem "2d Bar Chart"
  927.       .ItemData(0) = VtChChartType2dBar
  928.       .AddItem "3d Bar Chart"
  929.       .ItemData(1) = VtChChartType3dBar
  930.       .AddItem "2d Line Chart"
  931.       .ItemData(2) = VtChChartType2dLine
  932.       .AddItem "3d Line Chart"
  933.       .ItemData(3) = VtChChartType3dLine
  934.       .AddItem "2d Area Chart"
  935.       .ItemData(4) = VtChChartType2dArea
  936.       .AddItem "3d Area Chart"
  937.       .ItemData(5) = VtChChartType3dArea
  938.       .AddItem "2d Step Chart"
  939.       .ItemData(6) = VtChChartType2dStep
  940.       .AddItem "3d Step Chart"
  941.       .ItemData(7) = VtChChartType3dStep
  942.       .AddItem "2d Pie Chart"
  943.       .ItemData(8) = VtChChartType2dPie
  944.       .AddItem "3d Pie Chart"
  945.       .ItemData(9) = VtChChartType3dPie
  946.       .AddItem "Doughnut Chart"
  947.       .ItemData(10) = VtChChartType3dDoughnut
  948.       .AddItem "3d Cluster Bar Chart"
  949.       .ItemData(11) = VtChChartType3dClusteredBar
  950.       .AddItem "Bubble Chart"
  951.       .ItemData(12) = VtChChartType2dBubble
  952.       .ListIndex = 0       'Set the List index to the first item
  953.    End With
  954.    With cboFontSize
  955.       .AddItem "6"
  956.       .AddItem "7"
  957.       .AddItem "8"
  958.       .AddItem "9"
  959.       .AddItem "10"
  960.       .AddItem "11"
  961.       .AddItem "12"
  962.       .AddItem "14"
  963.       .AddItem "16"
  964.       .AddItem "18"
  965.       .AddItem "20"
  966.       .AddItem "24"
  967.       .AddItem "28"
  968.    End With
  969.    With cboLineSize
  970.       .AddItem "0"
  971.       .AddItem "1"
  972.       .AddItem "2"
  973.       .AddItem "3"
  974.       .AddItem "4"
  975.       .AddItem "5"
  976.    End With
  977.    For i = 0 To Screen.FontCount - 1
  978.       cboFontName.AddItem Screen.Fonts(i)
  979.    Next i
  980.    'Fill in the Drag/Drop Color Boxes
  981.    pctColors(0).BackColor = RGB(255, 0, 0)     ' Red
  982.    pctColors(1).BackColor = RGB(0, 255, 0)     ' Green
  983.    pctColors(2).BackColor = RGB(0, 0, 255)     ' Blue
  984.    pctColors(3).BackColor = RGB(255, 255, 64)  ' Yellow
  985.    pctColors(4).BackColor = RGB(226, 25, 136)  ' Pink
  986.    pctColors(5).BackColor = RGB(50, 150, 50)   ' Forest
  987.    pctColors(6).BackColor = RGB(0, 160, 240)   ' Light Blue
  988.    pctColors(7).BackColor = RGB(255, 160, 50)  ' Orange
  989.    pctColors(8).BackColor = RGB(255, 255, 255) ' White
  990.    Call SetLighting(0)
  991. End Sub
  992. Private Sub Form_Resize()
  993.    If ScaleWidth > 1000 And ScaleHeight > 1000 Then
  994.       With VtChart1
  995.          .Repaint = False                       'don't refresh
  996.          .Width = ScaleWidth - .Left - 60       'Resize the frame and
  997.          .Height = ScaleHeight - .Top - 60      'The chart to fit in the
  998.          pnlControls.Width = .Width             'Resized form
  999.          .Repaint = True                        'update chart
  1000.       End With
  1001.    End If
  1002. End Sub
  1003. Private Sub Form_Unload(Cancel As Integer)
  1004.    End
  1005. End Sub
  1006. Private Sub mnuAbout_Click()
  1007.    MsgBox "First Impression Demonstration Program" & Chr$(10) & Chr$(10) & _
  1008.        "Click on the chart pieces to select them" & Chr$(10) & _
  1009.        "or to drag pie pieces." & Chr$(10) & Chr$(10) & _
  1010.        "Double Click on the chart pieces to invoke" & Chr$(10) & _
  1011.        "the user interface." & Chr$(10) & Chr$(10) & _
  1012.        "Hold down the control key and drag the mouse" & Chr$(10) & _
  1013.        "to rotate 3D charts." & Chr$(10) & Chr$(10) & _
  1014.        "Drag colors to chart parts, or change the font" & Chr$(10) & _
  1015.        "size or line thickness."
  1016.        
  1017. End Sub
  1018. Private Sub mnuFileExit_Click()
  1019.    End
  1020. End Sub
  1021. Private Sub mnuWriteBitmap_Click()
  1022.    On Error GoTo FileReadErr
  1023.    With CommonDialog1
  1024.       .DialogTitle = "Write Chart to Bitmap File"
  1025.       .DefaultExt = "bmp"
  1026.       .Filter = "Bitmap Files (*.bmp)|*.bmp"
  1027.       .Flags = &H2
  1028.       .InitDir = App.Path
  1029.       .Action = 2
  1030.       VtChart1.WritePictureToFile .filename, VtPictureTypeBMP, 0
  1031.    End With
  1032.    Exit Sub
  1033. FileReadErr:
  1034.    MsgBox Error
  1035. End Sub
  1036. Private Sub mnuWriteMeta_Click()
  1037.    On Error GoTo FileReadErr
  1038.    With CommonDialog1
  1039.       .DialogTitle = "Write Chart to Windows MetaFile"
  1040.       .DefaultExt = "wmf"
  1041.       .Filter = " Metafiles (*.wmf)|*.wmf"
  1042.       .Flags = &H2
  1043.       .InitDir = App.Path
  1044.       .Action = 2
  1045.       VtChart1.WritePictureToFile .filename, VtPictureTypeWMF, 0
  1046.    End With
  1047.    Exit Sub
  1048. FileReadErr:
  1049.    MsgBox Error
  1050. End Sub
  1051. Private Sub optLight_Click(Index As Integer)
  1052.    Call SetLighting(Index)
  1053. End Sub
  1054. Private Sub VtChart1_AxisLabelSelected(AxisId As Integer, AxisIndex As Integer, _
  1055.    labelSetIndex As Integer, LabelIndex As Integer, MouseFlags As Integer, Cancel As Integer)
  1056.    gfiPartSelected = VtChPartTypeAxisLabel
  1057.    gfiAxisID = AxisId
  1058.    Call GetLineSize(VtChPartTypeAxisLabel)
  1059.    Call GetFontAndSize(VtChPartTypeAxisLabel)
  1060. End Sub
  1061. Private Sub VtChart1_AxisSelected(AxisId As Integer, AxisIndex As Integer, _
  1062.    MouseFlags As Integer, Cancel As Integer)
  1063.    gfiPartSelected = VtChPartTypeAxis
  1064.    gfiAxisID = AxisId
  1065.    Call GetLineSize(VtChPartTypeAxis)
  1066.    Call GetFontAndSize(VtChPartTypeAxis)
  1067. End Sub
  1068. Private Sub VtChart1_AxisTitleSelected(AxisId As Integer, AxisIndex As Integer, _
  1069.    MouseFlags As Integer, Cancel As Integer)
  1070.    gfiPartSelected = VtChPartTypeAxisTitle
  1071.    gfiAxisID = AxisId
  1072.    Call GetLineSize(VtChPartTypeAxisTitle)
  1073.    Call GetFontAndSize(VtChPartTypeAxisTitle)
  1074. End Sub
  1075. Private Sub VtChart1_ChartSelected(MouseFlags As Integer, Cancel As Integer)
  1076.    gfiPartSelected = VtChPartTypeChart
  1077.    Call GetLineSize(VtChPartTypeChart)
  1078.    Call GetFontAndSize(VtChPartTypeChart)
  1079. End Sub
  1080. Private Sub VtChart1_DragDrop(Source As Control, x As Single, y As Single)
  1081.    '' Handles drop of a picture box containing a image or color on
  1082.    '' any part that supports that fill type
  1083.    Dim r&, b&, g&, i1%, i2%, i3%, i4%
  1084.    Dim chartPart%, theBrushStyle&
  1085.    Dim pictureType&, pictureMap&, pictureName$
  1086.    Dim dataPoint As Object, imageTarget As Object
  1087.    With VtChart1
  1088.       ' Determine which chart part was dropped on
  1089.       .TwipsToChartPart x, y, chartPart, i1, i2, i3, i4
  1090.        
  1091.       ' If a color was dropped then change to that color
  1092.       If Source.Name = "pctColors" Then
  1093.          ' Null brush is special case
  1094.          theBrushStyle = IIf(Source.Index = 8, VtBrushStyleNull, VtBrushStyleSolid)
  1095.            
  1096.          ' Get the RGB values from the dropped color
  1097.          r = Source.BackColor And &HFF
  1098.          g = (Source.BackColor \ &H100) And &HFF
  1099.          b = (Source.BackColor \ &H10000) And &HFF
  1100.            
  1101.          Select Case chartPart
  1102.             Case VtChPartTypeChart
  1103.                With .Backdrop.Fill
  1104.                  .VtPicture.filename = ""
  1105.                  .Style = VtFillStyleBrush
  1106.                  .Brush.Style = theBrushStyle
  1107.                  .Brush.FillColor.Set r, g, b
  1108.                End With
  1109.             Case VtChPartTypeTitle
  1110.                .Title.VtFont.VtColor.Set r, g, b
  1111.             Case VtChPartTypeFootnote
  1112.                .Footnote.VtFont.VtColor.Set r, g, b
  1113.             Case VtChPartTypeLegend
  1114.                With .Legend.Backdrop.Fill
  1115.                  .VtPicture.filename = ""
  1116.                  .Style = VtFillStyleBrush
  1117.                  .Brush.Style = theBrushStyle
  1118.                  .Brush.FillColor.Set r, g, b
  1119.                End With
  1120.             Case VtChPartTypePlot
  1121.                With .Plot.Backdrop.Fill
  1122.                  .VtPicture.filename = ""
  1123.                  .Style = VtFillStyleBrush
  1124.                  .Brush.Style = theBrushStyle
  1125.                  .Brush.FillColor.Set r, g, b
  1126.                End With
  1127.             Case VtChPartTypeSeries
  1128.                For Each dataPoint In .Plot.SeriesCollection.Item(i1).DataPoints
  1129.                   With dataPoint
  1130.                     .VtPicture.filename = ""
  1131.                     .Brush.Style = theBrushStyle
  1132.                     .Brush.FillColor.Set r, g, b
  1133.                     .EdgePen.Style = VtPenStyleSolid
  1134.                     .EdgePen.VtColor.Set r, g, b
  1135.                     .VtPicture.Type = VtPictureTypeNull
  1136.                   End With
  1137.                Next dataPoint
  1138.             Case VtChPartTypeSeriesLabel
  1139.                .Plot.SeriesCollection.Item(i1).SeriesLabel.VtFont.VtColorSet r, g, b
  1140.             Case VtChPartTypePoint
  1141.                With .series(i1).DataPoints.Item(i2)
  1142.                   .VtPicture.filename = ""
  1143.                   With .Brush
  1144.                      .Style = theBrushStyle
  1145.                      .FillColor.Set r, g, b
  1146.                   End With
  1147.                   With .EdgePen
  1148.                      .Style = VtPenStyleSolid
  1149.                      .VtColor.Set r, g, b
  1150.                   End With
  1151.                 End With
  1152.             Case VtChPartTypePointLabel
  1153.                For Each dataPoint In .Plot.SeriesCollection.Item(i1).DataPoints
  1154.                   dataPoint.DataPointLabel.VtFont.VtColor.Set r, g, b
  1155.                Next dataPoint
  1156.             Case VtChPartTypeAxis
  1157.                .Plot.Axis(i1).Pen.VtColor.Set r, g, b
  1158.                .Plot.Axis(i1).AxisGrid.MajorPen.VtColor.Set r, g, b
  1159.             Case VtChPartTypeAxisLabel
  1160.                .Plot.Axis(i1).Labels.Item(1).VtFont.VtColor.Set r, g, b
  1161.             Case VtChPartTypeAxisTitle
  1162.                .Plot.Axis(i1).AxisTitle.VtFont.VtColor.Set r, g, b
  1163.          End Select
  1164.       
  1165.       ' A picture has been dropped on a chart part
  1166.       ElseIf Source.Name = "pctImage" Then
  1167.          pictureType = IIf(Source.Index < 4, VtPictureTypeWMF, VtPictureTypeBMP)
  1168.          pictureMap = IIf(Source.Index < 4, VtPictureMapTypeFitted, VtPictureMapTypeTiled)
  1169.             
  1170.          Select Case Source.Index
  1171.             Case 0:
  1172.                pictureName = App.Path & "\APPLE.WMF"
  1173.             Case 1:
  1174.                pictureName = App.Path & "\PEACH.WMF"
  1175.             Case 2:
  1176.                pictureName = App.Path & "\bananas.wmf"
  1177.             Case 3:
  1178.                pictureName = App.Path & "\dollar.wmf"
  1179.             Case 4:
  1180.                pictureName = App.Path & "\fun.BMP"
  1181.             Case 5:
  1182.                pictureName = App.Path & "\party.BMP"
  1183.             Case Else:
  1184.                pictureName = ""
  1185.          End Select
  1186.            
  1187.          Select Case chartPart
  1188.             Case VtChPartTypeChart
  1189.                Set imageTarget = .Backdrop.Fill.VtPicture
  1190.             Case VtChPartTypeTitle
  1191.                Set imageTarget = .Title.Backdrop.Fill.VtPicture
  1192.             Case VtChPartTypeFootnote
  1193.                Set imageTarget = .Footnote.Backdrop.Fill.VtPicture
  1194.             Case VtChPartTypeLegend
  1195.                Set imageTarget = .Legend.Backdrop.Fill.VtPicture
  1196.             Case VtChPartTypePlot
  1197.                Set imageTarget = .Plot.Backdrop.Fill.VtPicture
  1198.             Case VtChPartTypeSeries
  1199.                Set imageTarget = .Plot.SeriesCollection.Item(i1).DataPoints.Item(-1).VtPicture
  1200.             Case VtChPartTypeSeriesLabel
  1201.                Set imageTarget = .Plot.SeriesCollection.Item(i1).SeriesLabel.Backdrop.Fill.VtPicture
  1202.             Case VtChPartTypePoint
  1203.                Set imageTarget = .Plot.SeriesCollection.Item(i1).dataPoint(i2).VtPicture
  1204.             Case VtChPartTypePointLabel
  1205.                Set imageTarget = .Plot.SeriesCollection.Item(i1).dataPoint(-1).DataPointLabel.Backdrop.Fill.VtPicture
  1206.             Case VtChPartTypeAxis
  1207.                Exit Sub
  1208.             Case VtChPartTypeAxisLabel
  1209.                Set imageTarget = .Plot.Axis(i1).Labels.Item(1).Backdrop.Fill.VtPicture
  1210.             Case VtChPartTypeAxisTitle
  1211.                Set imageTarget = .Plot.Axis(i1).AxisTitle.Backdrop.Fill.VtPicture
  1212.          End Select
  1213.          
  1214.          With imageTarget
  1215.             .filename = pictureName
  1216.             .Type = pictureType
  1217.             .Map = pictureMap
  1218.          End With
  1219.       
  1220.       End If
  1221.    End With
  1222. End Sub
  1223. Private Sub VtChart1_FootnoteSelected(MouseFlags As Integer, Cancel As Integer)
  1224.    gfiPartSelected = VtChPartTypeFootnote
  1225.    Call GetLineSize(VtChPartTypeFootnote)
  1226.    Call GetFontAndSize(VtChPartTypeFootnote)
  1227. End Sub
  1228. Private Sub VtChart1_LegendSelected(MouseFlags As Integer, Cancel As Integer)
  1229.    gfiPartSelected = VtChPartTypeLegend
  1230.    Call GetLineSize(VtChPartTypeLegend)
  1231.    Call GetFontAndSize(VtChPartTypeLegend)
  1232. End Sub
  1233. Private Sub VtChart1_PlotSelected(MouseFlags As Integer, Cancel As Integer)
  1234.    gfiPartSelected = VtChPartTypePlot
  1235.    Call GetLineSize(VtChPartTypePlot)
  1236.    Call GetFontAndSize(VtChPartTypePlot)
  1237. End Sub
  1238. Private Sub VtChart1_PointLabelSelected(series As Integer, dataPoint As Integer, MouseFlags As Integer, Cancel As Integer)
  1239.    gfiPartSelected = VtChPartTypePointLabel
  1240.    gfiSeriesID = series
  1241.    gfiDataPointID = dataPoint
  1242.    Call GetLineSize(VtChPartTypePointLabel)
  1243.    Call GetFontAndSize(VtChPartTypePointLabel)
  1244. End Sub
  1245. Private Sub VtChart1_SeriesLabelSelected(series As Integer, MouseFlags As Integer, Cancel As Integer)
  1246.    gfiPartSelected = VtChPartTypeSeriesLabel
  1247.    gfiSeriesID = series
  1248.    Call GetLineSize(VtChPartTypeSeriesLabel)
  1249.    Call GetFontAndSize(VtChPartTypeSeriesLabel)
  1250. End Sub
  1251. Private Sub VtChart1_SeriesSelected(series As Integer, MouseFlags As Integer, Cancel As Integer)
  1252.    gfiPartSelected = VtChPartTypeSeries
  1253.    gfiSeriesID = series
  1254.    Call GetLineSize(VtChPartTypeSeries)
  1255.    Call GetFontAndSize(VtChPartTypeSeries)
  1256. End Sub
  1257. Private Sub VtChart1_Titleselected(MouseFlags As Integer, Cancel As Integer)
  1258.    gfiPartSelected = VtChPartTypeTitle
  1259.    Call GetLineSize(VtChPartTypeTitle)
  1260.    Call GetFontAndSize(VtChPartTypeTitle)
  1261. End Sub
  1262.