Results 1 to 6 of 6

Thread: MSFlexgrid help needed plz

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    182

    MSFlexgrid help needed plz

    After merging the columns...say i have three columns and the first column is merged.. when i click on any row it does not get high lighted..also the width of my first column is 0 so that it is not shown to the user..how ever when i make it visible to the user and click on the rows the first column appears to be highlighted..like the border color changes to but the cell inside is not highlighted..

    is there are a way the when a user clicks on the row..that paticular row gets highlighted..

    i'll really appreciate any help in this matter

  2. #2
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: MSFlexgrid help needed plz

    You highlight it manually changing that row backcolor, you can find an example about this and other Flexgrid tricks in This Post

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    182

    Re: MSFlexgrid help needed plz

    ok i get a good understanding..with that..i have seen that earlier but did not have any clue..so can u tell me ..if i have four columns and 4 rows then if i click any of them then using a loop..can i change color of row columns for example 0 to 3

    thanx

  4. #4
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: MSFlexgrid help needed plz

    try this..
    VB Code:
    1. Private Sub MSFlexGrid1_Click()
    2. Static iLastRow      As Integer
    3.  
    4.     With MSFlexGrid1
    5.         .Redraw = False
    6.         .FillStyle = flexFillRepeat 'To extend the selection
    7.         If iLastRow <> 0 Then
    8.             .Row = iLastRow
    9.             .RowSel = iLastRow
    10.             .Col = 0
    11.             .ColSel = .Cols - 1
    12.             .CellBackColor = .BackColor
    13.         End If
    14.        
    15.         .Row = .MouseRow
    16.         .RowSel = .MouseRow
    17.         .Col = 0
    18.         .ColSel = .Cols - 1
    19.         .CellBackColor = &H80000018
    20.         .FillStyle = flexFillSingle
    21.         .Redraw = True
    22.         iLastRow = .MouseRow
    23.     End With
    24. End Sub


    And this is a Merge example, its merges 6 cells..
    VB Code:
    1. Private Sub Form_Load()
    2. Dim i As Integer
    3.  
    4.     With MSFlexGrid1
    5.         .SelectionMode = flexSelectionByRow
    6.         .Rows = 10
    7.         .Cols = 10
    8.         .FixedCols = 0 'Here I select No fixed Cols, you can change it
    9.         .MergeCells = flexMergeFree
    10.         .MergeRow(1) = True: .MergeRow(2) = True
    11.         For i = 1 To 2
    12.             .TextMatrix(i, 1) = "Merging This"
    13.             .TextMatrix(i, 2) = "Merging This"
    14.             .TextMatrix(i, 3) = "Merging This"
    15.         Next
    16.         .Row = 1: .Col = 1
    17.         .CellAlignment = flexAlignCenterCenter
    18.         .Row = 2: .Col = 1
    19.         .CellAlignment = flexAlignCenterCenter
    20.     End With
    21. End Sub
    Last edited by jcis; Nov 24th, 2005 at 07:26 PM.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    182

    Re: MSFlexgrid help needed plz

    you are a legend...thanx for that..you saved a hell of my time..and one last thing what does mouserow means

  6. #6
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: MSFlexgrid help needed plz

    .MouseRow is the Row where you clicked with the mouse,
    .MouseCol is the Col where you clicked with the mouse.

    I edited my post and added center Alignment to merged cells.

    With .FillStyle = flexFillRepeat the cellbackground color change apply to all selected cells, but you have to restore to normal after that with .FillStyle = flexFillSingle, as in the example.

    .SelectionMode must be flexSelectionByRow, else its not very easy to align text (it moves the first time).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width