Bonjour,

Je programme avec visual studio 2008.
J'aurais voulu afficher un texte sur microsoft emulator.

voila mon code :


le main :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Media;
 
using FusionWare.SPOT.Hardware;
 
namespace MFWindowApplication22
{
    /// <summary>Core apllication object for the application</summary>
    public class App : FusionWare.SPOT.Application
    {
        #region Application Entry Point
        /// <summary>Main entry point for the application</summary>
        public static void Main()
        {
            // Init and run the application main window
            App theApp = new App();
            theApp.Run(theApp.MainWindow);
        }
        #endregion
 
        #region Constructor
        /// <summary>Constructor for the application object</summary>
        /// <remarks>
        /// Creates a new Full Screen BouncyViewWindow as the
        /// main window for the application.
        /// </remarks>
        App()
            : base(App.ButtonDefs)
        {
            this.MainWindow = new MainViewWindow();
            this.MainWindow.Height = SystemMetrics.ScreenHeight;
            this.MainWindow.Width = SystemMetrics.ScreenWidth;
        }
        #endregion
 
        #region Button Definitions
        /// <summary>Button Definitions for this application</summary>
        /// <remarks>
        /// For Demo purposes defines all the directions and select button. 
        /// Currently the only one actually used in this application is the select button.
        /// </remarks>
        static ButtonDefinition[] ButtonDefs = {
                // TODO: Add button definitions here for this application
                // new ButtonDefinition(Button.Up, true, Pins.SW5),
                // new ButtonDefinition(Button.Left, true, Pins.SW6),
                // new ButtonDefinition(Button.Select, false, Pins.SW7),
                // new ButtonDefinition(Button.Right, true, Pins.SW8),
                // new ButtonDefinition(Button.Down, true, Pins.SW9) 
        };
        #endregion
    }
}

le mainviewwindows :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Hardware;
using DeviceSolutions.SPOT.Hardware;
 
namespace MFWindowApplication22
{
    /// <summary>Main Window For the application</summary>
    /// <remarks>
    /// Creates a Text region child element
    /// </remarks>
    public class MainViewWindow : Window
    {
        static InterruptPort SW1;
        private Font SmallFont;
        static int var = 0;
        /// <summary> Constructor for the window</summary>
        public MainViewWindow()
        {
             this.SmallFont = Resources.GetFont(Resources.FontResources.small);
             SW1 = new InterruptPort(Tahoe.Pins.SW1, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
             SW1.OnInterrupt += new NativeEventHandler(SW1_OnInterrupt);
             this.Child = new view(this.SmallFont,var);
        }
 
        void SW1_OnInterrupt(uint data1, uint data2, TimeSpan time)
        {
            var++;
        }
    }
}
le view :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Hardware;
using DeviceSolutions.SPOT.Hardware;
 
namespace MFWindowApplication22
{
    class view : UIElement
    {
        private Bitmap bm;
        private Font myfont;
        private int var;
        public view(Font textFont,int nb){
                   bm = new Bitmap(240, 320);
                   myfont = textFont;
                   var = nb;
                   drawText(bm);
             }
        public void drawText(Bitmap bm)
        {
            bm.Clear();
            bm.DrawText("HELLO. Variale n° :" + var, myfont, Color.Black, 1, 1);
              bm.DrawLine(Color.Black, 2, 1, 1, 100, 100);
          }
    }
}

Mon code n'affiche rien quand je l'exécute ...
Je débute en C#....


Merci