home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{02B5E320-7292-11CF-93D5-0020AF99504A}#2.0#0"; "MSCHRT20.OCX"
- Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
- Begin VB.Form frmGRAPHEdit
- Caption = "Chart Data Editing"
- ClientHeight = 7305
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 10080
- BeginProperty Font
- Name = "Verdana"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- LinkTopic = "Form1"
- ScaleHeight = 7305
- ScaleWidth = 10080
- StartUpPosition = 3 'Windows Default
- Begin MSChartLib.MSChart MSChart1
- Height = 4650
- Left = 150
- OleObjectBlob = "DataEdit.frx":0000
- TabIndex = 0
- Top = 120
- Width = 7035
- End
- Begin VB.CommandButton bttnPsteBMP
- Caption = "Paste Graph Bitmap"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 465
- Left = 7425
- TabIndex = 18
- Top = 6075
- Width = 2475
- End
- Begin VB.CommandButton bttnPaste
- Caption = "Paste Data"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 465
- Left = 7425
- TabIndex = 17
- Top = 5520
- Width = 2475
- End
- Begin VB.CommandButton bttnCopy
- Caption = "Copy Data"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 465
- Left = 7425
- TabIndex = 16
- Top = 4980
- Width = 2475
- End
- Begin VB.TextBox Text1
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 285
- Left = 75
- TabIndex = 2
- Text = "Text1"
- Top = 4785
- Visible = 0 'False
- Width = 1170
- End
- Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
- Height = 2190
- Left = 720
- TabIndex = 1
- Top = 5010
- Width = 5475
- _ExtentX = 9657
- _ExtentY = 3863
- _Version = 393216
- Rows = 11
- Cols = 5
- End
- Begin VB.Frame Frame1
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 4095
- Left = 7365
- TabIndex = 3
- Top = 30
- Width = 2520
- Begin VB.OptionButton ChartType
- Caption = "3D Bar"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Index = 0
- Left = 210
- TabIndex = 15
- Top = 240
- Width = 1440
- End
- Begin VB.OptionButton ChartType
- Caption = "2D Bar"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Index = 1
- Left = 210
- TabIndex = 14
- Top = 555
- Value = -1 'True
- Width = 1440
- End
- Begin VB.OptionButton ChartType
- Caption = "3D Line"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Index = 2
- Left = 210
- TabIndex = 13
- Top = 870
- Width = 1440
- End
- Begin VB.OptionButton ChartType
- Caption = "2D Line"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Index = 3
- Left = 210
- TabIndex = 12
- Top = 1185
- Width = 1440
- End
- Begin VB.OptionButton ChartType
- Caption = "3D Area"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Index = 4
- Left = 210
- TabIndex = 11
- Top = 1500
- Width = 1440
- End
- Begin VB.OptionButton ChartType
- Caption = "2D Area"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Index = 5
- Left = 210
- TabIndex = 10
- Top = 1815
- Width = 1440
- End
- Begin VB.OptionButton ChartType
- Caption = "3D Step"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Index = 6
- Left = 210
- TabIndex = 9
- Top = 2130
- Width = 1440
- End
- Begin VB.OptionButton ChartType
- Caption = "2D Step"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Index = 7
- Left = 210
- TabIndex = 8
- Top = 2445
- Width = 1440
- End
- Begin VB.OptionButton ChartType
- Caption = "3D Combination"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Index = 8
- Left = 210
- TabIndex = 7
- Top = 2745
- Width = 1815
- End
- Begin VB.OptionButton ChartType
- Caption = "2D Combination"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Index = 9
- Left = 210
- TabIndex = 6
- Top = 3075
- Width = 1830
- End
- Begin VB.OptionButton ChartType
- Caption = "2D Pie"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Index = 14
- Left = 210
- TabIndex = 5
- Top = 3390
- Width = 1440
- End
- Begin VB.OptionButton ChartType
- Caption = "2D X-Y"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 270
- Index = 16
- Left = 210
- TabIndex = 4
- Top = 3705
- Width = 1440
- End
- End
- Attribute VB_Name = "frmGRAPHEdit"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' ******************************
- ' ******************************
- ' ** MASTERING VB6 **
- ' ** by Evangelos Petroutos **
- ' ** SYBEX, 1998 **
- ' ******************************
- ' ******************************
- Private Sub bttnCopy_Click()
- MSChart1.EditCopy
- End Sub
- Private Sub bttnPaste_Click()
- ' Paste clipboard's contents on the MSChart control
- MSChart1.EditPaste
- ' Uncomment the following lines
- ' to print the type of the data on the Clipboard
- Debug.Print "Bitmap = " & Clipboard.GetFormat(vbCFBitmap)
- Debug.Print "MetaFile = " & Clipboard.GetFormat(vbCFMetafile)
- Debug.Print "RTF = " & Clipboard.GetFormat(vbCFRTF)
- End Sub
- Private Sub bttnPsteBMP_Click()
- ' Paste chart's bitmap on the frmGRAPHBitmap.Picture1 control
- frmGRAPHBitmap.Show
- frmGRAPHBitmap.Picture1.Picture = Clipboard.GetData()
- End Sub
- Private Sub ChartType_Click(Index As Integer)
- ' Change the chart's type
- ' THIS CODE WORKS BECAUSE THE OPTION BUTTONS HAVE
- ' NON-CONSECUTIVE INDEX VALUES!
- MSChart1.ChartType = Index
- End Sub
- Private Sub Form_Load()
- Me.Show
- Me.Refresh
- MSFlexGrid1.Col = 0
- ' Set 1st column's width on the grid control
- MSFlexGrid1.ColWidth(0) = TextWidth("POINT # 999")
- ' Display row titles on the first column of the grid
- For irow = 1 To MSChart1.RowCount
- MSFlexGrid1.Row = irow
- MSFlexGrid1.Text = "POINT # " & irow
- Next
- ' scan each column of the grid and ...
- For icol = 1 To MSChart1.ColumnCount
- MSChart1.Column = icol
- MSFlexGrid1.Col = icol
- MSFlexGrid1.Row = 0
- ' ...set the column title
- MSFlexGrid1.Text = "SET # " & icol
- ' ...get chart's column's color assign it to the grid's column's
- If MSChart1.ChartType <> VtChChartType2dLine Or MSChart1.ChartType <> VtChChartType3dLine Then
- With MSChart1.Plot.SeriesCollection(icol).DataPoints(-1).Brush.FillColor
- clr = RGB(.Red, .Green, .Blue)
- End With
- Else
- With MSChart1.Plot.SeriesCollection(icol).Pen.VtColor
- clr = RGB(.Red, .Green, .Blue)
- End With
- End If
- ' scan each row of the chart control,
- ' read its value and assign it to the matching cell of the grid
- For irow = 1 To MSChart1.RowCount
- MSChart1.Row = irow
- MSFlexGrid1.Row = irow
- MSFlexGrid1.Col = icol
- MSFlexGrid1.Text = MSChart1.Data
- MSFlexGrid1.CellBackColor = clr
- Next
- Next
- ' In case the chart is 3D, rotate it
- MSChart1.Plot.View3d.Set 60, 30
- End Sub
- Private Sub MSChart1_PointSelected(Series As Integer, DataPoint As Integer, MouseFlags As Integer, Cancel As Integer)
- ' get the chart's selected point's coordinates
- ' and use them to select a cell on the grid. Then call
- ' the SetTextBox subroutine to prepare the cell for editing
- MSChart1.Column = Series
- MSChart1.Row = DataPoint
- MSFlexGrid1.Row = MSChart1.Row
- MSFlexGrid1.Col = MSChart1.Column
- SetTextBox
- End Sub
- Private Sub MSFlexGrid1_Click()
- ' prepare another grid cell for editing
- MSChart1.Row = MSFlexGrid1.Row
- MSChart1.Column = MSFlexGrid1.Col
- SetTextBox
- End Sub
- Private Sub MSFlexGrid1_Scroll()
- ' This handler ends the editing of the current cell
- ' when the grid control is scrolled
- ' Remove this line to see what happens when
- ' the FlexGrid control is scrolled
- Text1_KeyPress (13)
- End Sub
- Private Sub Text1_Change()
- ' comit changes made to the TextBox control
- ' by copying its value to the active cell
- MSFlexGrid1.Text = Text1.Text
- End Sub
- Private Sub Text1_KeyPress(KeyAscii As Integer)
- ' The Enter key ends the editing of the current cell
- If KeyAscii = 13 And Text1.Visible = True Then
- Text1.Visible = False
- MSChart1.Data = Text1.Text
- End If
- End Sub
- Private Sub Text1_LostFocus()
- ' When the TextBox loses the focus, the editing of the current cell ends
- Text1.Visible = False
- MSChart1.Data = Text1.Text
- End Sub
- Sub SetTextBox()
- ' This subroutine resizes the TextBox according to the size
- ' of the current cell and places it on top of it, so that
- ' the user thinks he's editing a cell on the grid, not the TextBox
- ' Set the TextBox control's coordinates
- Text1.Left = MSFlexGrid1.Left + MSFlexGrid1.CellLeft
- Text1.Top = MSFlexGrid1.Top + MSFlexGrid1.CellTop
- ' Set the TextBox control's size
- Text1.Width = MSFlexGrid1.CellWidth
- Text1.Height = MSFlexGrid1.CellHeight
- ' copy the cell's contents to the TextBox and select it
- Text1.Text = MSFlexGrid1.Text
- Text1.SelStart = 0
- Text1.SelLength = Len(Text1.Text)
- ' make the TextBox visible
- Text1.Visible = True
- ' and finally move the focus to the TextBox control
- Text1.SetFocus
- End Sub
-