Trying to rotate text on a Canvas paint event, and getting nothing.
Does anyone have an knowledge how to use the DrawRotatedTextMBS function.

I have tried the following

Xpos = 50
Ypos = 150
tmpText = “TEST1”
g.DrawRotatedTextMBS(180, tmpText, XPos, YPos)
g.DrawRotatedTextMBS 180, tmpText, XPos, YPos1
g.DrawRotatedTextMBS(180, tmpText, XPos, YPos1, false, 1.0, false, 0)

I don’t get an error, however I get nothing displayed either.

Any help would be very much appreciated.

Thank you,

Hm. Current plugins?

I put this in a paint event handler:

Sub Paint(g As Graphics, areas() As REALbasic.Rect) Handles Paint
  const Xpos = 50
  const Ypos = 150
  const Ypos1 = 50
  const tmpText = "TEST1"
  g.DrawRotatedTextMBS(180, tmpText, XPos, YPos)
  g.DrawRotatedTextMBS 180, tmpText, XPos+100, YPos1
  g.DrawRotatedTextMBS(180, tmpText, XPos, 100, false, 1.0, false, 0)
End Sub

and I got this:

Bildschirmfoto 2021-02-10 um 09.35.27

on Windows in both Xojo 2020r2 and 2019r1.

Thank you for your quick reply, I do appreciate it.

Ok, so it seems that my command is correct.
I’m using the latest version of plugins (21.0) and xojo 2020r2.
I just tried the commands using a new canvas and placing the canvas at the top=0 and left=0 and I can see my text on the canvas.

So, it seems that the Xpos and Ypos are based on the window that the canvas is on instead of the canvas itself. Is that correct?


I think that I have control over the positioning somewhat, so thank you.

However, I have found that the text size from g.DrawText is different than the text size from g.DrawRotatedText. Is there anything I can do to correct this?

I need to position top, center, bottom and left, center, right, so getting the size correct is very important to my program. Any suggestion?

Well, you can use our function or maybe try the newer rotation feature on the graphics class.

And what new rotation feature are you talking about?
Are you talking about stringshape?


Thank you very much.


I’m not sure that Graphics.rotate will work.
Here is what I’m trying to accomplish.