how to drawText by GenericTypographic in winform?

mc 4,576 Reputation points
2024-11-04T10:36:59.62+00:00

in .net android (android application)

I want to draw text which same like winform's GenericTypographic' but there is no such that in android?

I create bitmap

var bitmap=new Android.Graphics.Bitmap(150,36,Bitmap.Config.Argb8888);
var canvas =new Canvas(bitmap);
canvas.DrawText(mystr,width,height,paint);

and I can do it in winform(system.drawing).

I can drawString using graphics. and If I mesureString using StringFormat.GenericDefault it is unclear

If I use StringFormat.GenericTypographic to measureString and then draw it it is ok.

now the text was not ok that I draw in android. is that the measure is wrong?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,589 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.