This is a migrated thread and some comments may be shown as answers.

Odd HTML Formatting of ScreenTip

2 Answers 93 Views
Panel
This is a migrated thread and some comments may be shown as answers.
Kurt Boyer
Top achievements
Rank 1
Kurt Boyer asked on 14 Oct 2015, 02:23 PM

I'm using the RadOffice2007ScreenTipElement to show errors for rows within my RadGridView. When the ScreenTip displays, the html text is shown with weird spacing and odd vertical alignment for certain words.

 I've attached a screenshot of what I'm seeing. Take a look at the ScreenTip and notice the word "job" within the error "Blank job group code." There also seems to be extra spacing after that word, and after the word "EEO".

 Here is the relevant code snippet:

private void RadGridView1_ScreenTipNeeded(object sender, ScreenTipNeededEventArgs e)
{
  var cell = e.Item as GridDataCellElement;
  if (cell != null)
  {
    switch (cell.ColumnInfo.Name)
    {
      case "errorimage":
          int rowIndex = radGridView1.Rows.IndexOf(radGridView1.CurrentRow);
          if (rowIndex > -1)
          {
            if (cell.RowElement.RowInfo.Cells["errortext"].Value.ToString() != "")
            {
              var screenTip = new RadOffice2007ScreenTipElement();
              screenTip.CaptionLabel.Margin = new Padding(3);
              screenTip.CaptionLabel.Text = "Job Error(s)";
              screenTip.MainTextLabel.Text = cell.RowElement.RowInfo.Cells["errortext"].Value.ToString().Trim();
              screenTip.EnableCustomSize = true;
              e.Delay = 50;
              e.Item.ScreenTip = screenTip;
            }
            else
            {
                e.Item.ScreenTip = null;
              }
          }
          break;
        default:
            break;
    }
  }
}

Is there any way to fix this?

2 Answers, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 19 Oct 2015, 11:14 AM
Hello Kurt,

Thank you for writing.

The Html-like feature has a known issue related to the incorrect painting because some fonts do not report correctly their text metrics. For example, Segoe UI and Tahoma with font size 8.5 do not render correctly - they report incorrectly some text metrics and changing the font to Segoe UI with size 9 (or Verdana 8.25, which looks pretty good) fixes the incorrect rendering. As a solution I can suggest the following:

RadOffice2007ScreenTipElement screenTip = new RadOffice2007ScreenTipElement();
screenTip.CaptionLabel.Margin = new Padding(3);
screenTip.CaptionLabel.Text = "Job Error(s)";
screenTip.MainTextLabel.Font = new System.Drawing.Font("Verdana", 8.25f);

Alternatively you can also achieve a good result by setting the TextWrap property to false:
RadOffice2007ScreenTipElement screenTip = new RadOffice2007ScreenTipElement();
screenTip.CaptionLabel.Margin = new Padding(3);
screenTip.CaptionLabel.Text = "Job Error(s)";
screenTip.MainTextLabel.TextWrap = false;

I am sending you a attached screenshots showing the result on my end using either approach.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Kurt Boyer
Top achievements
Rank 1
answered on 19 Oct 2015, 12:16 PM
This works perfectly. Thank you very much Hristo! :)
Tags
Panel
Asked by
Kurt Boyer
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Kurt Boyer
Top achievements
Rank 1
Share this question
or