GUI - Car Wash Example

I have tried running the Car Wash example but I get the following error:

Total deployment size is 1,363,420 bytes.
Incrementally deploying assemblies to the device:
The deployment is 1,363,420 bytes which cannot fit into the deployment area which is 786,432 bytes.
Assemblies not successfully deployed to the device.
Deployment to the device was not successful.

Is there something I am missing or loading that I should be? the CarWashExample.pe file is 1,106,706 bytes which seem quite large.

I converted everything to run under Preview 3 and modified it to work on the 7" display on the SC20260D board.

Do not add bitmap resource, use jpg. There is a bitmap that 1.3MB which is too large.

That worked thank you!

In a large GUI application there will be a lot of resources. Is there a way to push them to the SD card?

1 Like

yes, font, image you can load from SDCard or USB

Is there a way to change the background color of a text box? I see it has a ForeColor for the color of the text but I don’t see a way to change the color of the background.

textbox.Background = new SolidColorBrush(GHIElectronics.TinyCLR.UI.Media.Color.FromRgb(r,g,b));

@Dat_Tran Thanks. I was using a Text object, not a TextBox object. Switching to TextBox solved the problem.

Well the TextBox solves the Background issue but there doesn’t seem to be any TextAlignment options with a TextBox. Am I just not finding them or do they not exist?
HorizontalAlignment and VerticalAlignment don’t seem to have any affect on the text.

they may not exist. but textbox is simple, i can show how to inherit when back to my desk.

Sounds good, Thanks you.
It would also be helpful to see an example of pulling resources from the SD card. I had no idea fonts could take up so much room. Using a the 7" display requires some sizable fonts.

Hi, we just added TextAlign field in TextBox that help to align the text in box.

But in case you want more, like text moving in box :grinning: , or don’t want to re-build UI library, see code below.

    public sealed class TextBoxExtend:TextBox {
        public TextAlignment TextAlign { get; set; } = TextAlignment.Left;

        public TextBoxExtend() : base () {

        }

        public override void OnRender(DrawingContext dc) {
            if (!(this.Foreground is SolidColorBrush b)) throw new NotSupportedException();

            var txt = this.Text;

            dc.DrawRectangle(this._background, null, 0, 0, this.Width, this.Height);
            dc.DrawText(ref txt, this._font, b.Color, 0, this._font.Height /2, this.Width, this._font.Height, this.TextAlign, TextTrimming.CharacterEllipsis);
        }
    }

For font, you can use:

var font = new Font(byte[] data);

data is an array that can be loaded from SD/USB

1 Like