Hello everyone, English is not my native language, so I used translation tools, I hope you can understand
In the following code, how do I draw the character where the first blue line is?
I tried many times, but I couldn’t figure out the rules
[code]dim image as Picture = new Picture(Canvas1.Width, Canvas1.Height)
dim g as Graphics = image.Graphics
g.DrawingColor = Color.White
g.FillRectangle(0,0,image.Width,image.Height)
Thank you, but it seems that the problem has not been solved. Let me draw it in your way. The text is still quite far from the top. Oddly enough, I’m using c# to implement the same code, but it’s just not the same as xojo.
c# code
Bitmap image = new Bitmap(pictureBox1.Width, pictureBox1.Height);
Graphics g = Graphics.FromImage(image);
Pen p = new Pen(Color.Black);
g.DrawString("Test", new Font("Arial", 24), p.Brush, 0, 0);
pictureBox1.Image = image;
xojo code
[code]dim image as Picture = new Picture(Canvas1.Width, Canvas1.Height)
dim g as Graphics = image.Graphics
Var tx As New TextShape
tx.FontName = “Arial”
tx.FontSize = 96 /72 * 24
tx.x=0
tx.y=0
tx.FillColor = Color.Black
tx.Value = “Test”
tx.VerticalAlignment = TextShape.Alignment.Top
tx.HorizontalAlignment = TextShape.Alignment.Left
g.DrawObject(tx)
Canvas1.Backdrop = image[/code]
60/5000
The display is completely different. For whatever reason, the characters drawn in c# have left margins and the top margins are shorter than in xojo. And c# looks a little thicker, right?
Hello, I used the translator, so I may not have communicated my question well. I don’t quite understand why xojo draws things differently from other languages for the same code.