CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Flex Grid

  1. #1
    Join Date
    Sep 1999
    Posts
    4

    Flex Grid

    In a Flexgid control i want to Print all column headings with font 'bold', but all the values in the cell to normal font.
    also for flexgrid i want to set the values in the cell to center align . i used msflex.Cellalignment = flexAlignCenterCenter.
    it worked only for first cell. i want all cells to be center aligned.
    can any one tell me how to do that?


    Thanks in advance.
    Bill


  2. #2
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Re: Flex Grid


    for i = 0 to NumberOfRows
    MSFlexGrid1.CellAlignment = vbCenter
    if i=0 then MSFlexGrid1.CellFontBold = true
    next i




    Michael Vlastos
    Automation Engineer
    Company Modus SA
    Development Department

  3. #3
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Flex Grid

    Here's an easy way to handle the centering of all cells (excluding fixed rows/columns) :


    With YourFlexGridControl
    .Redraw = false ' turn of flickering / highlight
    .FillStyle = flexFillRepeat ' apply to all selected cells
    .Col = .FixedCols ' set col
    .Row = .FixedRows ' set row
    .ColSel = .Cols - 1 ' set selected col position
    .RowSel = .Rows - 1 ' set selected row position
    .CellAlignment = flexAlignCenterCenter ' apply cell alignment to all
    .Col = 0 ' reset col
    .Row = 0 ' reset row
    .Col = .FixedCols
    .Row = .FixedRows
    .FillStyle = flexFillSingle
    .Redraw = true
    End With





    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

  4. #4
    Join Date
    Sep 1999
    Posts
    4

    Re: Flex Grid

    Thank you very much. It worked fine. also is it possible in Flex grid to print column headings in 'bold' and all other values to not bold?

    Bill.


  5. #5
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Flex Grid

    You can use the same (kind-of) code snippet -


    With MSFlexGrid1
    .Redraw = false ' turn of flickering / highlight
    .FillStyle = flexFillRepeat ' apply to all selected cells
    .Col = .FixedCols ' set col
    .Row = 0 ' set row
    .ColSel = .Cols - 1 ' set selected col position
    .RowSel = .FixedRows ' set selected row position
    .CellAlignment = flexAlignCenterCenter ' apply cell alignment to all
    .CellFontBold = true
    .Col = 0 ' reset col
    .Row = 0 ' reset row
    .Col = .FixedCols
    .Row = .FixedRows
    .FillStyle = flexFillSingle
    .Redraw = true
    End With




    This will center and make bold all of the column headers in the flexgrid.


    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

  6. #6
    Join Date
    Sep 1999
    Posts
    4

    Re: Flex Grid

    Thank you very much for your reply.


    Bill


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

Featured