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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Covered Cell In GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

59030 Apr 3,2007 08:22 PM UTC Apr 3,2007 10:12 PM UTC Windows Forms 2
loading
Tags: GridControl
Felix De Herrera
Asked On April 3, 2007 08:22 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


Felix De Herrera
Replied On 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

haneefm [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;