We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Font Orientation and cell/row width and heigth

Hi, I'm playing around with the font's orientation in header cols. All I want to have is that the font is oriented by 90 degrees and the whole text is displayed in the (header) cell. But I don't manage it. Can someone give me a hint? Here's my code snippet: private void Form1_Load(object sender, System.EventArgs e) { gc[1,1].Text = "isdahfkashdfasdfjaskfdjaslkdfjklsjdfkasjdfklsjfkljasldkfj"; gc[1,1].Font.Orientation = 90; //gc[1,1].WrapText = false; //gc.ColWidths.ResizeToFit(Syncfusion.Windows.Forms.Grid.GridRangeInfo.Cell(1,1)); gc.RowHeights.ResizeToFit(Syncfusion.Windows.Forms.Grid.GridRangeInfo.Cell(1,1)); gc.Refresh(); } thanks, Michael

1 Reply

AD Administrator Syncfusion Team April 9, 2003 01:48 PM UTC

There appears to be a problem with the RowHeights.ResizeToFit handling the Orientation properly. We will have to look into it. As a workaround, you could calculate the string length and use that for the row height. Here is a little snippet.
private void Form1_Load(object sender, System.EventArgs e)
{
	this.gridControl1[1,1].Text = "isdahfkashdfasdfjaskfdjaslkdfjklsjdfkasjdfklsjfkljasldkfj";
	this.gridControl1[1,1].WrapText = false;
	this.gridControl1[1,1].Font.Orientation = 90;

	Graphics g = this.gridControl1.CreateGraphics();
	this.gridControl1.RowHeights[1] = 
 		(int) g.MeasureString(this.gridControl1[1,1].Text ,this.gridControl1.Font).Width; 		
	g.Dispose();

	//this.gridControl1.ColWidths[1] = 24;

}

Loader.
Up arrow icon