IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

affichage de texte (debutant)


Sujet :

C#

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Août 2008
    Messages
    24
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2008
    Messages : 24
    Par défaut affichage de texte (debutant)
    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

  2. #2
    Membre averti
    Profil pro
    Inscrit en
    Août 2008
    Messages
    24
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2008
    Messages : 24
    Par défaut help plz
    je crois qu'il faut utiliser un truc comme :

    mais je ne comprend pas comment cça fonctionne



    help plz

Discussions similaires

  1. [debutant] TextAera et affichage de texte
    Par daed dans le forum AWT/Swing
    Réponses: 6
    Dernier message: 09/03/2006, 11h50
  2. Affichage de texte
    Par Yellowmat dans le forum OpenGL
    Réponses: 2
    Dernier message: 15/12/2004, 12h25
  3. [C#] Affichage de texte vertical...
    Par AntiSAL dans le forum Windows Forms
    Réponses: 6
    Dernier message: 10/06/2004, 14h46
  4. Affichage de texte est mise à jour de l'écran
    Par Galdor_sp dans le forum OpenGL
    Réponses: 3
    Dernier message: 14/03/2004, 22h31
  5. [MX 2004] Affichage du texte dynamique
    Par caramel dans le forum Flash
    Réponses: 8
    Dernier message: 29/01/2004, 16h07

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo