Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使文本出现在 FXCanvas 上。当我使用此代码时:
def score_box(event) FXDCWindow.new(@canvas) do |dc| dc.drawText(640, 450, @score) end end
但它给了我一个错误,说我需要选择一种字体,我该怎么做?还是您可以提供在画布上制作文字的方法?谢谢
-双极裤
您需要在设备上下文 (dc) 中选择一个 FXFont 对象,例如
FXDCWindow.new(@canvas) do |dc| font = FXFont.new(...) font.create dc.font = font dc.drawText(640, 450, @score) end