LucaMs Expert Licensed User Longtime User Sep 30, 2014 #1 I use this to calculate the Y coordinate of a text to draw on a panel using a canvas, but it does not work well. B4X: Y_CnvText = (Panel1.Height + cnv.MeasureStringHeight(mText, mTypeFace1, mTextSize)) /2
I use this to calculate the Y coordinate of a text to draw on a panel using a canvas, but it does not work well. B4X: Y_CnvText = (Panel1.Height + cnv.MeasureStringHeight(mText, mTypeFace1, mTextSize)) /2
LucaMs Expert Licensed User Longtime User Sep 30, 2014 #3 klaus said: What doesn't work well ? Click to expand... It is no centered. Upvote 0
klaus Expert Licensed User Longtime User Sep 30, 2014 #4 I'm afraid that your properties are not correct after scaling like in THIS project of yours!? Upvote 0
LucaMs Expert Licensed User Longtime User Oct 1, 2014 #5 Another test Attachments canvas measures.zip 12.4 KB · Views: 114 Upvote 0
klaus Expert Licensed User Longtime User Oct 1, 2014 #7 You should use: cnv.MeasureStringHeight("a", Typeface.DEFAULT, TextSize) instead of cnv.MeasureStringHeight(Text, Typeface.DEFAULT, TextSize) Attachments canvas measures_1.zip 12.3 KB · Views: 130 Upvote 0
You should use: cnv.MeasureStringHeight("a", Typeface.DEFAULT, TextSize) instead of cnv.MeasureStringHeight(Text, Typeface.DEFAULT, TextSize)