|
-
December 12th, 2007, 01:04 PM
#1
Need help with MSFlexgrid formatstring.
I have a flexgrid with one column and many rows.
How do I use the format string when there is only one column?
for two columns this works...
control.FormatString = "ROI Area" & "|<" & "ROI Max"
but which column does the "|<" format? The first or the second?
-
December 12th, 2007, 02:15 PM
#2
Re: Need help with MSFlexgrid formatstring.
Code:
control.FormatString = "Col_FIXED|COL1|COL2|COL3|"
but which column does the "|<" format? The first or the second?
answer is "|"
now, if you don't want to use fixed column try out :
Code:
control.FormatString = " |COL1"
-
December 12th, 2007, 04:04 PM
#3
Re: Need help with MSFlexgrid formatstring.
I want the first and sole column to be centered text.
-
December 12th, 2007, 05:18 PM
#4
Re: Need help with MSFlexgrid formatstring.
Check this out:
Code:
Private Declare Function SetProp Lib "user32.dll" Alias "SetPropA" (ByVal hwnd As Long, ByVal lpString As String, ByVal hData As Long) As Long
Private Sub Form_Load()
Dim N, NN As Integer
'\\Preparar grelha
With GrHistorico
.Cols = 8
.Rows = 200
.FixedCols = 0
.FixedRows = 1
.TextMatrix(0, 0) = "Data"
.TextMatrix(0, 1) = "Utilizador"
.TextMatrix(0, 2) = "Janela"
.TextMatrix(0, 3) = "Operação"
.TextMatrix(0, 4) = "Documento"
.TextMatrix(0, 5) = "Divisa"
.TextMatrix(0, 6) = "ID int."
.TextMatrix(0, 7) = "Valorização"
'\\Agora as medidas
.ColWidth(0) = 1700
.ColWidth(1) = 1200
.ColWidth(2) = 4500
.ColWidth(3) = 4500
.ColWidth(4) = 4500
.ColWidth(5) = 1000
.ColWidth(6) = 1000
.ColWidth(7) = 1300
'\\Alinhamentos das colunas
.ColAlignment(0) = flexAlignCenterCenter
.ColAlignment(1) = flexAlignLeftCenter
.ColAlignment(2) = flexAlignLeftCenter
.ColAlignment(3) = flexAlignLeftCenter
.ColAlignment(4) = flexAlignLeftCenter
.ColAlignment(5) = flexAlignCenterCenter
.ColAlignment(6) = flexAlignRightCenter
.ColAlignment(7) = flexAlignRightCenter
'\\Alinhamentos dos cabeçalhos
.FixedAlignment(0) = flexAlignCenterCenter
.FixedAlignment(1) = flexAlignLeftCenter
.FixedAlignment(2) = flexAlignLeftCenter
.FixedAlignment(3) = flexAlignLeftCenter
.FixedAlignment(4) = flexAlignLeftCenter
.FixedAlignment(5) = flexAlignCenterCenter
.FixedAlignment(6) = flexAlignRightCenter
.FixedAlignment(7) = flexAlignRightCenter
'populate some rows and cols
For N = 0 To 7
For NN = 1 To 199
.TextMatrix(NN, N) = "Just for testing ..."
Next NN
Next N
End With
SubClassMsGRID GrHistorico, Picture1
End Sub
Private Sub Form_Resize()
On Error Resume Next
GrHistorico.Move 300, 300, Me.ScaleWidth - 600, Me.ScaleHeight - 600
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnSubClassMsGRID GrHistorico.hwnd
End Sub
Private Sub GrHistorico_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
With GrHistorico
SetProp .hwnd, "Click", .Row
.Refresh
End With
End Sub
ignore the subclassing stuff
Last edited by dglienna; December 12th, 2007 at 05:21 PM.
-
December 13th, 2007, 12:36 PM
#5
Re: Need help with MSFlexgrid formatstring.
Thanks!
Last question...
The first column of the grid is grey/gray in color/colour...
How can I make have the same color and behavior of the rest of the columns?
-
December 13th, 2007, 12:55 PM
#6
Re: Need help with MSFlexgrid formatstring.
how about .BackColor and .ForeColor
-
December 13th, 2007, 05:24 PM
#7
Re: Need help with MSFlexgrid formatstring.
I think my command line completion tool isn't working! lol.
Thanks... doh!
-
December 14th, 2007, 02:05 PM
#8
Need help with MSFlexgrid.
Something is wierd with my flexgrid.
I set selectionmode to flexSelectByRow
in flexgrid click event I want to get the row that the user clicked on.
however I notice that every thing from the first row to the row that the user clicked on is selected and the .row property is 1....
I don't get it...
-
December 14th, 2007, 02:08 PM
#9
Re: Need help with MSFlexgrid formatstring.
try mouserow and mousecol
-
December 14th, 2007, 03:33 PM
#10
Re: Need help with MSFlexgrid formatstring.
Why is the previous selected row still highlighted as a selected row?
Is there a flag for multiple selection that I'm not setting?
I set the flag AllowBigSelection to false...
But every thing above the current mouse click row is highlighted...
Last edited by JustSomeGuy; December 14th, 2007 at 03:57 PM.
-
December 14th, 2007, 03:39 PM
#11
Re: Need help with MSFlexgrid formatstring.
No, but you can clear them all. I used to color the selected cells, and have to repaint them each time
-
December 14th, 2007, 04:17 PM
#12
Re: Need help with MSFlexgrid formatstring.
Code:
with gridname
for i=0 to .rows
HOW DO I SET THE BACKGROUND COLOR OF ROW I TO WHITE
next
end with
-
December 14th, 2007, 05:13 PM
#13
Re: Need help with MSFlexgrid formatstring.
Alternately!
Code:
Option Explicit
Private Sub Command1_Click()
Dim i As Integer
For i = 1 To flx.Rows - 1
If i Mod 2 = 0 Then
With flx
.FillStyle = flexFillRepeat
.Row = i
.RowSel = i
.Col = 1
.ColSel = .Cols - 1
.CellBackColor = vbRed
.CellForeColor = vbWhite
End With
End If
Next i
flx.Row = 1
End Sub
Private Sub Form_Load()
Dim i As Integer, j As Integer
With flx
For i = 1 To flx.Rows - 1
For j = 0 To .Cols - 1
.TextMatrix(i, j) = i & ", " & j
Next j
Next i
End With
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|