FD
Felix De Herrera
April 3, 2007 09:10 PM UTC
>Hi All,
Is there a way to have a row that is basically a horizontal gradient with text in a GDBG? Covered ranges don't seem to exist in a bound grid. Any help is appreciated. ~Felix
Figured it out:
Public Sub InsertGradientHeader(ByVal iRow As Integer, ByVal sCaption As String)
m_grid.Model.CoveredRanges.AddRange(New Syncfusion.Windows.Forms.Grid.GridRangeInfo() {Syncfusion.Windows.Forms.Grid.GridRangeInfo.Cells(iRow, 1, iRow, m_grid.Model.ColCount)})
m_grid(iRow, 1).Interior = New Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Horizontal, SystemColors.Desktop, SystemColors.Window)
m_grid(iRow, 1).Text = sCaption
m_grid(iRow, 1).Font.Bold = True
m_grid(iRow, 1).TextColor = Color.White
m_grid(iRow, 1).CellType = "Static"
m_grid(iRow, 1).ReadOnly = True
m_grid(iRow, 1).Clickable = False
m_grid(iRow, 1).Enabled = False
m_grid(iRow, 1).Text = DataInfo.CEnumsInfo.LineTypes.GradientHdr.ToString End Sub
HA
haneefm
Syncfusion Team
April 3, 2007 10:12 PM UTC
Hi Felix,
If you want to draw the gradient text in a grid cell, you can handle the DrawCellDisplayText event and draw the gradient display text using the DrawString method. the following is the code snippet
private void gridDataBoundGrid1_DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e)
{
if( e.RowIndex > 0 && e.ColIndex > 0 )
{
e.Cancel = true;
LinearGradientBrush myBrush = new LinearGradientBrush(e.TextRectangle, Color.Violet, Color.White, LinearGradientMode.Horizontal);
e.Graphics.DrawString(e.DisplayText,e.Style.GdipFont,myBrush,e.TextRectangle);
}
}
Best regards,
Haneef