Main Site Documentation

SimpleGraphics.DisplayText


#1

Hi
I tested the SimpleGraphics.DisplayText() today.
but it is not work.
What I am missing?

     namespace GadgeteerApp1
{
    public partial class Program
    {
        // This method is run when the mainboard is powered up or reset.   
       
        void ProgramStarted()
        {
            
            Debug.Print("Program Started");
            button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
           
        }
        string test = "test";
        void button_ButtonPressed(Button sender, Button.ButtonState state)
        {
            
            led.BlinkOnce(Colors.Blue);
            display.SimpleGraphics.DisplayText(test,9,Colors.Brown,50,50);
            
        }
    }
}

#2

I am a bit confused.

display.SimpleGraphics.DisplayText(test,9,Colors.Brown,50,50);

The DisplayText method requires a Font object after the text string. You have the number 9?


#3

:slight_smile:

Why dont you use this instead of 9 ?

var font = Resources.GetFont(Resources.FontResources.small);

#4

@ Mike, you are right, thanks.
@ Weiti, thanks, its work and your HANDLERS also works too. Thanks a lot.