Control Font Issue

Control Font Issue

Anonymous
Not applicable
905 Views
3 Replies
Message 1 of 4

Control Font Issue

Anonymous
Not applicable

Font.png

 

The image is my revit add-in program.

 

I set the same font property of groupbox and all controls in groupbox.

 

but only group box font is specified. other controls font is not specified.

 

I tried to make winform program like revit add-in program like below image.

 

font2.png

 

all controls font is specified.

 

what is the problem?

 

 

0 Likes
906 Views
3 Replies
Replies (3)
Message 2 of 4

gopinath.taget
Alumni
Alumni

Hello,

 

I will need to look at the actual sample project to see what the problem is. However, from your description this looks like a WinForms issue and not a Revit API issue. Is this a Revit API issue? Or are you seeing this problem only in a Revit Addin? Do you see this problem in a stand alone application?

 

Thanks

Gopinath

0 Likes
Message 3 of 4

arnostlobel
Alumni
Alumni

BIMS_Keris,

 

It is not clear to me from your description what exactly is the problem. It looks like the fonts in those two dialogs are the same. What appears different (correct me if I am wrong) is smoothing of the text. While Revit appears to use some level of smoothing  for the labels, your dialog does not. As I understand it, WinForms do not expose smoothing property on labels by default. If you so desire, you can override the behavior in OnPaint even of the controls by setting TextRenderingHint to AntiAlias, AntiAliasGridFit, or ClearTypeGridFit. I assume there must be some snippet somewhere to google.

 

Does that sound like what you had in mind?

 

Arnošt Löbel

Autodesk, Revit R&D

Arnošt Löbel
0 Likes
Message 4 of 4

Anonymous
Not applicable

The grouped objects on the left are not displayed correctly.The grouped objects on the left are not displayed correctly.

Note: The grouped objects on the left are not displayed correctly

 

Yes, I know this problem.

Here is the solution (For example Label):

public partial class CustomLabel : Label
{
private TextRenderingHint _hint = TextRenderingHint.AntiAliasGridFit;
public TextRenderingHint TextRenderingHint
{
get { return this._hint; }
set { this._hint = value; }
}

protected override void OnPaint(PaintEventArgs pe)
{
pe.Graphics.TextRenderingHint = TextRenderingHint;
base.OnPaint(pe);
}
}

0 Likes