Results 1 to 7 of 7

Thread: [RESOLVED] Krool's VBFlexGrid -How to adjust row height and col width to eliminate grey area?

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2021
    Posts
    46

    Resolved [RESOLVED] Krool's VBFlexGrid -How to adjust row height and col width to eliminate grey area?

    Hello,

    I want my Flexgrid to appear like this, without any grey area.

    Name:  fg.jpg
Views: 776
Size:  17.5 KB

    I got it by
    Code:
    fg.ColWidthMin=fg.Width/fg.Cols
    
    fg.RowHeightMin=fg.Height/fg.Rows
    
    fg.ScrollBars=vbSBNone
    
    fg.BorderStyle=FlexBorderStyleNone
    I still had to adjust the width and height of Flexgrid, by trial and error, to completely get rid of the grey areas on the right and at the bottom.

    Is there some way to do it directly, without all that tweaking?

  2. #2

    Thread Starter
    Member
    Join Date
    Jan 2021
    Posts
    46

    Re: Krool's VBFlexGrid -How to adjust row height and col width to eliminate grey area

    @admin

    I am sorry. I have posted in the wrong group, by oversight.
    It has to go to the Parent group.
    I don't see a way either to delete this post or to shift it.

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2021
    Posts
    46

    Re: Krool's VBFlexGrid -How to adjust row height and col width to eliminate grey area

    Did it.

    I went the other way around.
    Code:
        fg.Height = fg.RowHeight(0) * fg.Rows - 30
        fg.Width = fg.ColWidth(0) * fg.Cols - 30
    There was a thin grey line and I had to subtract 30 to remove that also.

    I suppose this post can remain in this group itself, to serve as an useful code snippet.

  4. #4
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: Krool's VBFlexGrid -How to adjust row height and col width to eliminate grey area

    Quote Originally Posted by Yakkov View Post
    Did it.

    I went the other way around.
    Code:
        fg.Height = fg.RowHeight(0) * fg.Rows - 30
        fg.Width = fg.ColWidth(0) * fg.Cols - 30
    There was a thin grey line and I had to subtract 30 to remove that also.

    I suppose this post can remain in this group itself, to serve as an useful code snippet.
    Why you magic offset 30?
    You can set the .GridColorFixed property to match your .BackColor property.
    This way the outline will not visually disturb you. (Ofcourse set .GridLines and .GridLinesFixed to 0 - None)

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2021
    Posts
    46

    Re: Krool's VBFlexGrid -How to adjust row height and col width to eliminate grey area

    Quote Originally Posted by Krool View Post
    Why you magic offset 30?
    You can set the .GridColorFixed property to match your .BackColor property.
    This way the outline will not visually disturb you. (Ofcourse set .GridLines and .GridLinesFixed to 0 - None)
    Wow, Yes, It works!
    As simple as that ?!

    Thank you once more.

    Here is my goal and my code.
    Code:
       
     'I want a Grid which appears like a Text box with
        '5 columns and 10 rows of text, evenly spaced
        'no lines and no borders
        With fg
            .Cols = 5
            .Rows = 8
            
            'All this just for that
            .FixedCols = 0
            .FixedRows = 0
            .ScrollBars = vbSBNone
            .GridLines = FlexGridLineNone
            .GridLinesFixed = FlexGridLineNone
             
            'FYI    .Width =5055
    
            'to distribute equally and force all columns of same width        
            .ColWidthMin = .Width / .Cols
            .ColWidthMax = .ColWidthMin
            
            'similarly for rows
            .RowHeightMin = .Height / .Rows
            .RowHeightMax = .RowHeightMin
            
            'A little grey area on the right
           .GridColorFixed = .BackColor
    
            'the gray area almost vanishes, but I still find a thin border on the right  
            'further tweaking
            .Height = .RowHeight(0) * .Rows 
            .Width = .ColWidth(0) * .Cols 
        
    End With
    It looks too noobish. There must be some direct way
    Last edited by Yakkov; Jan 27th, 2021 at 04:06 AM.

  6. #6
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,375

    Re: Krool's VBFlexGrid -How to adjust row height and col width to eliminate grey area

    Quote Originally Posted by Yakkov View Post
    Wow, Yes, It works!
    As simple as that ?!

    Thank you once more.

    Here is my goal and my code.
    Code:
       
     'I want a Grid which appears like a Text box with
        '5 columns and 10 rows of text, evenly spaced
        'no lines and no borders
        With fg
            .Cols = 5
            .Rows = 8
            
            'All this just for that
            .FixedCols = 0
            .FixedRows = 0
            .ScrollBars = vbSBNone
            .GridLines = FlexGridLineNone
            .GridLinesFixed = FlexGridLineNone
             
            'FYI    .Width =5055
    
            'to distribute equally and force all columns of same width        
            .ColWidthMin = .Width / .Cols
            .ColWidthMax = .ColWidthMin
            
            'similarly for rows
            .RowHeightMin = .Height / .Rows
            .RowHeightMax = .RowHeightMin
            
            'A little grey area on the right
           .GridColorFixed = .BackColor
    
            'the gray area almost vanishes, but I still find a thin border on the right  
            'further tweaking
            .Height = .RowHeight(0) * .Rows 
            .Width = .ColWidth(0) * .Cols 
        
    End With
    It looks too noobish. There must be some direct way
    Looks good. You may add ".BorderStyle = FlexBorderStyleNone" for completeness.
    I tested this and I do NOT see a grey area left "on the right side" as you wrote.. Can you share a picture/demo ?

    EDIT: maybe your width of the control and equally distributed cols are not matching 100%. Maybe you have to adjust your design time width by 15 twips (= 1 pixel) so it is even.
    Last edited by Krool; Jan 27th, 2021 at 05:32 AM.

  7. #7

    Thread Starter
    Member
    Join Date
    Jan 2021
    Posts
    46

    Re: Krool's VBFlexGrid -How to adjust row height and col width to eliminate grey area

    Quote Originally Posted by Krool View Post
    Looks good.
    Thank you very much. I am elated.

    Quote Originally Posted by Krool View Post
    You may add ".BorderStyle = FlexBorderStyleNone" for completeness.
    Yes, of course. That was actually the first thing I did. But since it was done in IDE, it escaped the Code listing.

    I tested this and I do NOT see a grey area left "on the right side" as you wrote..
    EDIT: maybe your width of the control and equally distributed cols are not matching 100%.
    Your reasoning is correct.
    You would have noticed it, if you had set fg.width=5055

    Maybe you have to adjust your design time width by 15 twips (= 1 pixel) so it is even.
    With that final tweak, one doesn't have to bother about adjusting the width at design 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