-
Jan 26th, 2021, 06:30 AM
#1
Thread Starter
Member
[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.
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?
-
Jan 26th, 2021, 08:30 AM
#2
Thread Starter
Member
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.
-
Jan 26th, 2021, 08:57 AM
#3
Thread Starter
Member
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.
-
Jan 26th, 2021, 11:55 AM
#4
Re: Krool's VBFlexGrid -How to adjust row height and col width to eliminate grey area
Originally Posted by Yakkov
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)
-
Jan 27th, 2021, 03:29 AM
#5
Thread Starter
Member
Re: Krool's VBFlexGrid -How to adjust row height and col width to eliminate grey area
Originally Posted by Krool
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.
-
Jan 27th, 2021, 05:28 AM
#6
Re: Krool's VBFlexGrid -How to adjust row height and col width to eliminate grey area
Originally Posted by Yakkov
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.
-
Jan 27th, 2021, 11:06 AM
#7
Thread Starter
Member
Re: Krool's VBFlexGrid -How to adjust row height and col width to eliminate grey area
Originally Posted by Krool
Looks good.
Thank you very much. I am elated.
Originally Posted by Krool
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|