vb6textmsflexgrid

text orientation flexgrid


Is there anyway to align the text in msflexgrid in vertical orientation like excel does?

thanks

alt text


Solution

  • There is a lot to rotating Fonts by 90 degrees. VB6 uses an OLE StdFont object part of the stdole2 type library.

    You will have to convert the StdFont into a GDI font to be able to manipulated it.

    Here is a very nice post (Text At Any Angle) with sample code to go on doing exactly that.

    The sample is drawing on a form, but I would think you can get a handle to a MSFlexGrid and draw into that.

    You can then control when and how the text is drawn. If you want to edit the vertical text at runtime, you can show a horizontal textbox over the cell instead while editing the text and then draw the new text when finished editing.