Newbie question

Hi I want to try the following code 'Raptor TinyCLR)

private static Window CreateWindow(DisplayController displayController)
var window = new Window
Height = (int) displayController.ActiveSettings.Height,
Width = (int) displayController.ActiveSettings.Width,
Background = new SolidColorBrush(GHIElectronics.TinyCLR.UI.Media.Color.FromArgb(255, 0, 0, 64))
var font = Resources.GetFont(Resources.FontResources.small);
OnScreenKeyboard.Font = font;

        var listBox = new ListBox { Child = { Width = window.Width } };

        for (var i = 0; i < 3; i++)
            var text = new Text(font, $"Text item {i}");

            text.ForeColor = Colors.Yellow;


I get the following error for the font

I have added the 2 fonts found in C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.4\Fonts

Ninab.tinyfft and small.tinyft in the Resources

Any hint on this ?

Thanks in advance

What contains your using ? (I’m glad my Nuget packages are useful to somebody :wink:)

1 Like

Sure there a useful to more people than just me :slight_smile:
Here are my using

using System.Diagnostics;
using System.Drawing;
using System.Threading;
using Bauland.Gadgeteer;
using GHIElectronics.TinyCLR.Devices.Display;
using GHIElectronics.TinyCLR.Pins;
using GHIElectronics.TinyCLR.UI;
using GHIElectronics.TinyCLR.UI.Controls;
using GHIElectronics.TinyCLR.UI.Media;
using Color = System.Drawing.Color;
using Pen = System.Drawing.Pen;
using TinyCLRApplication1.Properties;

Do you have…
using Yournamespace.Properties; // Needed for Resources

Yes I have it (using TinyCLRApplication1.Properties)

but don’t ask me why but I have restarted VS to check and the error is gone.
now I have another error but I will check this this evening after work

When you create a resource file, you must compile program before you can see Resources. Maybe you didn’t build before to put Resources.GetFont().

1 Like

You’re right. :slight_smile:

1 Like