[RESOLVED] Align Centre in MSHFlexgrid
Can someone help me out here?
Why is it that even though I have defined a column to align to centre, the numerical values in the column correctly align but a column header (which is text) still aligns to left. Below is the code that I'm using.
VB Code:
x=10
MSHFlexgrd.ColAlignment(1) = flexAlignCenterCenter
MSHFlexgrd.TextMatrix(0, 1) = "Column Header"
MSHFlexgrd.TextMatrix(2, 1) = x
Re: Align Centre in MSHFlexgrid
Quote:
but a column header (which is text) still aligns to left.
For the header you need to use
VB Code:
MSHFlexGrd.ColAlignmentHeader(1) = 4
'or
MSHFlexGrd.ColAlignmentHeader(1) = flexAlignCenterCenter
Hope this helps...
Re: Align Centre in MSHFlexgrid
Koolsid,
Didn't realise that but for some reason it's still not working???
Re: Align Centre in MSHFlexgrid
Re: Align Centre in MSHFlexgrid
Yea,
Tried 1, 2, 3, 4 & 5 and none of them did anything to the alignment. :confused:
There is .ColHeader and .ColHeaderCaption which I haven't used yet
at the moment I have just used the .TextMatrix(0,i) to enter the Column header text but not sure what the difference would be.
Re: Align Centre in MSHFlexgrid
Maybe it's my mistake
the syntax is
http://msdn.microsoft.com/library/de...ntProperty.asp
what is the band number? try it with bandnumber.
Hope this finally helps :)
ps: your other thread regarding Wheelmouse scroll MDI application child forms doesn't give you that error anymore... http://vbforums.com/showthread.php?t=444999
Re: Align Centre in MSHFlexgrid
Can't seem to work out what the band number is. Row number = 0 doesn't seem to work.
ie. MSHFlexgrid.ColAlignmentHeader(0, 1) = flexAlignCenterCenter
Re: Align Centre in MSHFlexgrid
Alignment works just fine in the "regular" MsFlexGrid so if you don't Hierarchical grid then switch to MsFlexGrid instead.
And you only need to set ColAlignment - it doesn't have ColAlignmentHeader:
MSHFlexgrd.ColAlignment(1) = flexAlignCenterCenter
Re: Align Centre in MSHFlexgrid
Quote:
Alignment works just fine in the "regular" MsFlexGrid so if you don't Hierarchical grid then switch to MsFlexGrid instead.
And you only need to set ColAlignment - it doesn't have ColAlignmentHeader:
MSHFlexgrd.ColAlignment(1) = flexAlignCenterCenter
Hmmm... Hi Check this out ...
@sgrya1: I might be wrong (just a thought)... do the string in the header have any leading/trailing spaces?
I am sure that it has to do something with the bandnumber...will search msdn for some info and get back...
Re: Align Centre in MSHFlexgrid
Koolsid,
Thanks, There are no leading or trailing spaces. Your last link linked to the same location as the one before it.
Rhinobull,
I have to use the MSHFlexgrid as I found a while back that there were printing problems with the "regular" MsFlexGrid. For some reason it printed out as a solid black box.
This is strange,
Rather than:
MSHFlexgrd.TextMatrix(0, 1) = "Column Header" (Which Aligns Left)
x=10
MSHFlexgrd.TextMatrix(2, 1) = x (Aligns Right while the rest of the column is still centre)
So it's definately something to do with the .colheader
MSHFlexgrd.TextMatrix(0, 1) = x
Re: Align Centre in MSHFlexgrid
Re: Align Centre in MSHFlexgrid
Thanks for the link koolsid.
"Unfortunately, while the control works like a charm in this respect, in other areas it's rather clunky. For instance, when it comes to applying data formats to entire grid columns, this control falls short."
Read the rest but still no joy.
That explains that the band is the row number though.
\par \tab For I = 0 To .Bands - 1
\par \tab\tab For x = 0 To .Cols(I) - 1
\par \tab\tab\tab header = .ColHeaderCaption(I, x)
Re: Align Centre in MSHFlexgrid
Quote:
Originally Posted by sgrya1
... I found a while back that there were printing problems with the "regular" MsFlexGrid. For some reason it printed out as a solid black box...
I am clueless as to what that might be ... :confused: It's the first time I've heard that. How did you "print" your grid?
Re: Align Centre in MSHFlexgrid
Guess what?????
it works....
uploading the project files in few minutes...
Re: Align Centre in MSHFlexgrid
Here are few things, i would like to mention...
1) right click on the MSHFlexGrid1 and click on properties...
2) under the tab 'General' change Allowuserresizing to 'Both' so when you resize the column, u'll see the effect at runtime
keep the value of fixed col and fixed rows to 0
3) Under the 'bands' tab check the option 'columnheader'
4)
VB Code:
Private Sub Form_Load()
MSHFlexGrid1.ColAlignmentHeader(0, 1) = 4
End Sub
Hope this helps...
Re: Align Centre in MSHFlexgrid
Puhleeezzzzzz tell me it works.......... :D
Have been scratching my head on this for hours now... lol
Re: Align Centre in MSHFlexgrid
Thank you so much koolsid!!! It's got be baffled.
RhinoBull
Was a bit devestated when I found that I couldnt easily print a form with all controls. With a bit of help I ended upworking it out and posted ithere.
Re: Align Centre in MSHFlexgrid
Well, there is a better way of doing it but as long as it works for you that's what matters I guess. :thumb:
Re: Align Centre in MSHFlexgrid
Quote:
Thank you so much koolsid!!! It's got be baffled.
Is that a yes? lol (is it working?)
Re: Align Centre in MSHFlexgrid
You've got to be kidding me. How the did you work that out?
I've had a bit of a play around already. It was the fixed col and fixed row values which were the problem. They were set to 1 and when I changed them to 0 I get my flexAlignCenterCenter.
Thankyou!! Have to give you some reputation tomorrow too!!!
OMG!! Didn't even know there was a additional properties screen for controls.
RhinoBull. Please elaborate!! I was battling the print form problem for a week.
Re: [RESOLVED] Align Centre in MSHFlexgrid