Main Site Documentation

Why can I only select colors black or white


#1

Hi

I am quite new into NETMF (experienced C-programmer and some C# knowledge though).

I have the EMX board up and running quite fast and easy. Great!
Starting to play with the display, and this seems to work great too.

But something is missing, I think:

  • I can only choose between colors black and white. Why can’t I choose other colors?
  • I can’t use the “SystemMetrics.ScreenWidth” and “Height” when defining display size.

This is my source. It works, but I really want to be able to select other colors :o)
Is something missing?
I can’t add the references “Microsoft.SPOT.Presentation” and the “-.Media”, as they don’t appear in the refrences list. Is this a problem?

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Media;
using GHIElectronics.NETMF.Hardware;
using System.IO;

namespace EMX_Application1
{
public class Program
{

    public static void Main()
    {
        Int16 myValue = 0;
        string strString;
        Int16 toggle = 0;

        OutputPort myLED_1 = new OutputPort((Cpu.Pin)EMX.Pin.IO48, true);
        OutputPort myLED_2 = new OutputPort((Cpu.Pin)EMX.Pin.IO49, true);

        Bitmap LCD = new Bitmap(320, 240);

        LCD.Clear();
        LCD.DrawLine(Color.White, 1, 10, 10, 310, 10);
        LCD.DrawLine(Color.White, 1, 10, 10, 10, 230);

// LCD.DrawRectangle(Color.White, 1, 1, 1, 20, 20, 1, 1, Color.White, 0, 0, Color.White, 1, 1, 0);
LCD.Flush();

Thanks in advance!
Kaare


#2

try Colors.

the missing namespaces are in Microsoft.spot.grahics


#3

And you can use Microsoft.SPOT.Presentation.Media.ColorUtility to creat a color from RGB values.


#4

Ahhhhh, ColorS and not Color… I should have copy and pasted the example code :o)

But I am a bit confused about using namespaces and adding references:
I’m used to just “#include” and “using …” in the source.
But now I sometimes has to add the same reference in the project.

I have added the reference “Microsoft.SPOT.Graphics”, but this cannot be added in source as “using Microsoft.SPOT.Graphics”.

So I am confused about the usage of references vs using namespaces.

Can you explain this to me?

Thanks

Kaare


#5

Adding a Reference makes the code available to you.

[italic]Using[/italic] a namespace simply lets you address the code in a shorter fashion ColorUtility.ColorFromRGB for example instead of Microsoft.SPOT.Presentation.Media.ColorUtility.ColorFromRGB