home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form fMerge
- BackColor = &H00C0C0C0&
- BorderStyle = 3 'Fixed Double
- Caption = "Summary Sheet"
- ClientHeight = 5745
- ClientLeft = 915
- ClientTop = 1155
- ClientWidth = 8115
- Height = 6150
- Left = 855
- LinkTopic = "Form1"
- ScaleHeight = 5745
- ScaleWidth = 8115
- Top = 810
- Width = 8235
- Begin OptionButton Option1
- BackColor = &H00C0C0C0&
- Caption = "VSFlex"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 330
- Index = 1
- Left = 450
- TabIndex = 8
- Top = 1710
- Width = 1245
- End
- Begin Frame Frame1
- BackColor = &H00C0C0C0&
- Enabled = 0 'False
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00FF0000&
- Height = 1500
- Left = 360
- TabIndex = 4
- Top = 1740
- Width = 1935
- Begin CheckBox chkPictures
- BackColor = &H00C0C0C0&
- Caption = "Add Pictures"
- Enabled = 0 'False
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 225
- Left = 390
- TabIndex = 7
- Top = 420
- Width = 1245
- End
- Begin CheckBox chkMergeCells
- BackColor = &H00C0C0C0&
- Caption = "Merge Cells"
- Enabled = 0 'False
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 225
- Left = 405
- TabIndex = 6
- Top = 675
- Width = 1350
- End
- Begin CommandButton Command1
- BackColor = &H00C0C0C0&
- Caption = "Drag && Drop"
- Enabled = 0 'False
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 345
- Left = 390
- TabIndex = 5
- Top = 1020
- Width = 1095
- End
- End
- Begin OptionButton Option1
- BackColor = &H00C0C0C0&
- Caption = "Plain Grid"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 330
- Index = 0
- Left = 465
- TabIndex = 3
- Top = 1350
- Value = -1 'True
- Width = 1515
- End
- Begin vsFlexArray fa
- BackColor = &H00C0C0C0&
- BackColorFixed = &H00000000&
- Cols = 4
- ConvInfo = FMERGE.FRX:0000
- DragIcon = FMERGE.FRX:000B
- FixedCols = 0
- FocusRect = 0 'None
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColorFixed = &H0000FF00&
- FormatString = "^Region |^Product |^Employee |>Sales "
- GridColor = &H00008080&
- GridLines = 2 'Inset
- Height = 4650
- HighLight = 0 'Never
- Left = 2700
- RowHeightMin = 420
- Rows = 11
- ScrollBars = 0 'None
- ScrollTrack = -1 'True
- TabIndex = 0
- Top = 810
- Width = 5130
- End
- Begin Label Label2
- Alignment = 2 'Center
- BackColor = &H00C0C0C0&
- BackStyle = 0 'Transparent
- Caption = "See summary as:"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 13.5
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 585
- Index = 0
- Left = 270
- TabIndex = 2
- Top = 675
- Width = 1935
- End
- Begin Image flag
- Height = 480
- Index = 3
- Left = 810
- Picture = FMERGE.FRX:030D
- Top = 4860
- Visible = 0 'False
- Width = 480
- End
- Begin Image flag
- Height = 480
- Index = 2
- Left = 195
- Picture = FMERGE.FRX:060F
- Top = 4875
- Visible = 0 'False
- Width = 480
- End
- Begin Image flag
- Height = 480
- Index = 1
- Left = 2010
- Picture = FMERGE.FRX:0911
- Top = 4875
- Visible = 0 'False
- Width = 480
- End
- Begin Image flag
- Height = 480
- Index = 0
- Left = 1335
- Top = 4905
- Visible = 0 'False
- Width = 480
- End
- Begin Label Label1
- Alignment = 2 'Center
- BackColor = &H00000000&
- Caption = "Summary"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 24
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H0000FFFF&
- Height = 585
- Left = 2670
- TabIndex = 1
- Top = 165
- Width = 5175
- End
- Option Explicit
- Sub chkMergeCells_Click ()
- If fa.MergeCells = 0 Then
- fa.MergeCells = 2
- Else
- fa.MergeCells = 0
- End If
- End Sub
- Sub chkPictures_Click ()
- Dim i%
- fa.Row = 0
- For i = 0 To 3
- ' find "Country" column
- fa.Col = i
- If Trim(fa) = "Country" Then Exit For
- Next i
- If chkPictures Then
- DoAddFlagsToColumn (fa.Col)
- Else
- DoRemoveFlagsFrom (fa.Col)
- End If
- End Sub
- Sub Command1_Click ()
- MsgBox "Drag and drop column's headers and see the data automatically rearranged"
- End Sub
- Sub DoAddFlagsToColumn (Col)
- Dim i%
- fa.Col = Col
- For i = 1 To NUMREC - 1
- fa.Row = i
- fa.CellPictureAlignment = 1
- Select Case fa
- Case "USA": fa.CellPicture = flag(1)
- Case "Canada": fa.CellPicture = flag(2)
- Case "Germany": fa.CellPicture = flag(3)
- End Select
- Next i
- End Sub
- Sub DoFillData ()
- Dim i%
- ' from structure to FlexArray
- For i = 0 To NUMREC - 1
- fa.TextArray(fai(i, 0)) = MyData(i).Country
- fa.TextArray(fai(i, 1)) = MyData(i).Product
- fa.TextArray(fai(i, 2)) = MyData(i).Type
- fa.TextArray(fai(i, 3)) = Format$(MyData(i).Sales, "##.00")
- If Val(MyData(i).Sales) < 0 Then
- fa.Row = i
- fa.Col = 3
- fa.CellForeColor = RGB(255, 0, 0) ' negatives in red
- End If
- Next
- End Sub
- Sub DoInitialSettings ()
- Dim i%
- fa.Rows = NUMREC
- fa.ColAlignment(0) = 7 ' Align CenterLeft
- fa.Row = 0
- ' change fonts on title Row
- For i = 0 To fa.Cols - 1
- fa.Col = i
- fa.CellFontSize = 14
- fa.CellAlignment = 4 ' Center Center
- Next i
- ' merge only first 3 columns
- fa.MergeCol(0) = True
- fa.MergeCol(1) = True
- fa.MergeCol(2) = True
- End Sub
- Sub DoRemoveFlagsFrom (Col%)
- Dim i%
- For i = 1 To NUMREC - 1
- fa.Row = i
- fa.CellPicture = flag(0) ' No Flag
- Next i
- End Sub
- Sub DoSort ()
- fa.Col = 0
- fa.ColSel = fa.Cols - 1
- fa.Sort = 1 'numeric ascendent
- End Sub
- Sub fa_DragDrop (Source As Control, X As Single, Y As Single)
- If fa.Tag = "" Then Exit Sub
- fa.Redraw = False
- fa.ColPosition(Val(fa.Tag)) = fa.MouseCol
- DoSort
- fa.Redraw = True
- End Sub
- Sub fa_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
- ' Debug.Print "dn"
- fa.Tag = ""
- If fa.MouseRow <> 0 Then Exit Sub
- fa.Tag = Str(fa.MouseCol)
- fa.Drag 1
- End Sub
- Sub fa_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
- 'Debug.Print "up"
- End Sub
- Function fai (r%, c%) As Integer
- fai = c + fa.Cols * r
- End Function
- Sub Form_Load ()
- DoInitialSettings
- DoGetData
- DoFillData
- DoSort
- End Sub
- Sub Option1_Click (Index As Integer)
- ' enable and disable controls
- chkPictures.Enabled = Not chkPictures.Enabled
- chkMergeCells.Enabled = Not chkMergeCells.Enabled
- command1.Enabled = Not command1.Enabled
- frame1.Enabled = Not frame1.Enabled
- fa.Redraw = False
- chkPictures.Value = Index
- chkMergeCells.Value = Index
- fa.Redraw = True
- End Sub
-