I need dotted line under the text of each cell. Something link url link that need to be dotted line rather fixed horizontal straight line. My code goes as follows.
ultraGrid1.DisplayLayout.Bands[0].Columns[colIndex].CellActivation = Activation.NoEdit; Infragistics.Win.FormattedLinkLabel.UltraFormattedTextEditor urlLinkEditor = new Infragistics.Win.FormattedLinkLabel.UltraFormattedTextEditor(); urlLinkEditor.TreatValueAs = Infragistics.Win.FormattedLinkLabel.TreatValueAs.URL; urlLinkEditor.LinkClicked += new Infragistics.Win.FormattedLinkLabel.LinkClickedEventHandler(urlLinkEditor_LinkClicked); urlLinkEditor.UnderlineLinks = Infragistics.Win.FormattedLinkLabel.UnderlineLink.Always; urlLinkEditor.LinkAppearance.ForeColor = Color.Black; urlLinkEditor.VisitedLinkAppearance.ForeColor = Color.Black; urlLinkEditor.ScrollBarDisplayStyle = Infragistics.Win.UltraWinScrollBar.ScrollBarDisplayStyle.Never; ultraGrid1.DisplayLayout.Bands[0].Columns[colIndex].EditorComponent = urlLinkEditor;
I am getting the fixed line under the text but not dotted one. It would be really helpful if someone help me to acheive this. Thanks!
Hello Uthayakumar,
In class MyDrawFilter find public bool DrawElement(…) and replace existing code with the follows lines:
Rectangle elementRect = drawParams.Element.Rect;
TextSectionUIElement tse = (TextSectionUIElement)drawParams.Element.GetDescendant(typeof(TextSectionUIElement));
if (tse != null)
{
elementRect = tse.Rect;
borderPen.DashPattern = new float[] { 10f, 3f, 5f, 3f };
drawParams.Graphics.DrawLine(this.borderPen, new Point(elementRect.Location.X, elementRect.Bottom + 2),
new Point(elementRect.Right, elementRect.Bottom + 2));
}
return true;
Here the TextSectionUIElement contains the required linked text and determine start and end points for the dotted line or in other words, it determine the length of dotted line.
Let me know if you have any further questions.
Hi,
Thanks for the sample code. It works for me. But the dotted line is not formatted. I need to draw the line to the lenght of text inside the cell exactly. But this one always draw from left end to right end irrespective of the text lengh. Please help me to achieve this. thanks for the support
I have created a base sample for you, to achieve your goal. I used creation filter and draw filter in order to create the doted underline.
More information about Draw Filter and Creation Filter you can find here:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2010.2/CLR2.0/html/Win_Creation_Filter.html
http://help.infragistics.com/Help/NetAdvantage/WinForms/2009.1/CLR2.0/html/Win_Draw_Filter.html
You can modify the sample accordingly your needs .
I guess we could only alter the border of the cell using the IUIElementDrawFilter. is it possible to draw the dotted line below the text of the cell. Do u have any sample code.
To the best of my knowledge what you are describing is not even possible using .NET string rendering methods (Graphics.DrawString), since the Font class does not extend this functionality. You would probably have to use the IUIElementDrawFilter interface to draw the line manually.