QUOTE(tomtrak @ Jul 31 2006, 01:39 PM)

Hi,
I don't know how to rotate a text in a DataGridView column header to be written vertically from bottom to top.
I found a property called GdiVerticalFont in a datagridview ColumnHeadersDefaultCellStyle, but it doesn't work.
I don't have any experience in programming user controls so I hope that someone help me to find a good solution. I would be grateful for any tip how to modify an existing control, where to put the code and what to modify.
Thanks in advance
Hi,
try the following code,
Private Sub dgv_rmxOrdDetail_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles dgv_rmxOrdDetail.CellPainting
If e.RowIndex = -1 Then
e.PaintBackground(e.CellBounds, True)
e.Graphics.TranslateTransform(e.CellBounds.Left, e.CellBounds.Bottom)
e.Graphics.RotateTransform(270)
e.Graphics.DrawString(e.FormattedValue.ToString, e.CellStyle.Font, Brushes.Blue, 5, 5)
e.Graphics.ResetTransform()
e.Handled = True
End If
End Sub
To run this effectively, RowHeader.Visible should be false.
This code is working very properly for me.
bye
Reply