I need assistance with portion of drawing routine. I need to determine size of GeneralNote before placing note to my sheet. My notes are single or multi-line notes depending on length of note. I need to determine length to know if note will break to multi-line. I did not find function in Inventor API to get value. I cannot place note and move it. I must know position prior to placing to sheet.
I attempted use of .NET function `System.Windows.Forms.TextRenderer.MeasureText()`, but it seems Inventor calculates text size differently.
My trials are included;
?System.Windows.Forms.TextRenderer.MeasureText("XXXXXX", New System.Drawing.Font("ARIAL", 72)) {Width = 543 Height = 134} Empty: {Width = 0 Height = 0} Height: 134 height: 134 IsEmpty: False Width: 543 width: 543
When I perform math to convert pixels to inches to centimeters I get following
--I divide 120 which is from this.CreateGraphics().DpiX to convert pixels to inches
--I multiply 2.54 to convert inches to centimeters
543 / 120 * 2.54
Width = 11.4935
134 / 120 * 2.54
Height = 2.836333
I use same values for my GeneralNote;
FormattedText=<StyleOverride Font='Arial' FontSize='2.54'>XXXXXX</StyleOverride> LineSpacing=1 WidthScale=1
RESULTS...
Height=2.5399999618530273 Width=14.206189155578613
As you see there is significant difference in text size calculated via .NET and GeneralNote. Does any one have an idea?
Thank you