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

Windows Forms Discussion :

dll defectueuse (etat bouton)


Sujet :

Windows Forms

  1. #1
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Mai 2010
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2010
    Messages : 1
    Points : 1
    Points
    1
    Par défaut dll defectueuse (etat bouton)
    Bonjour,
    Voila j'ai pondu tout ce code et voila que je n'arrive pas à savoir pourquoi l'état désactiver"Disiable" ne s'active pas (tout les autre marche). J'ai cherché et encore cherché mais je trouve rien

    Merci d'avance de m'aider.

    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
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
     
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Data;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
     
    namespace UC_RichIcone
    {
        [DefaultEvent("Click")]
        public partial class UC_RichIcon : UserControl
        {
            public enum StateType { Disabled, Neutral, Over, Clicked };
            private StateType StateButton;
            private Image m_ImageNormal = null;
            private Image m_ImageClick = null;
            private Image m_ImageOver = null;
            private Image m_ImageDisiable = null;
            private bool Enable = false;
     
            public UC_RichIcon()
            {
                InitializeComponent();
            }
     
            private void UC_RichIcon_Load(object sender, EventArgs e)
            {
                this.BackgroundImageLayout = ImageLayout.Stretch;
                this.BackgroundImage = m_ImageNormal;
            }
            [Description("Etat du button")]
            public StateType EtatBouton
            {
                get { return StateButton; }
                set
                {
     
                    StateButton = value;
                    if (StateButton == StateType.Disabled && m_ImageDisiable != null)
                        this.BackgroundImage = m_ImageDisiable;
                    if (StateButton == StateType.Clicked && m_ImageClick !=null)
                        this.BackgroundImage = m_ImageClick;
                    if (StateButton == StateType.Neutral && m_ImageNormal !=null)
                        this.BackgroundImage = m_ImageNormal;
                    if (StateButton == StateType.Over && m_ImageOver !=null)
                        this.BackgroundImage = m_ImageOver;
                    // On refresh le contrôle
                    this.Refresh();
                }
            }
            [Description("si la propriete est pas init , disable est par default")]
            public bool IsEnable
            {
                get { return Enable; }
                set
                {
                    Enable = value;
                    if (!Enable)
                        StateButton = StateType.Disabled;
                    if(!Enable && m_ImageDisiable != null)
                        this.BackgroundImage = m_ImageDisiable;
                    else if(m_ImageNormal != null)
                        this.BackgroundImage = m_ImageNormal;
                    // On refresh le contrôle
                    this.Refresh();
                }
            }
     
            [Description("image etat normal")]
            public Image ImageNormal
            {
                get { return m_ImageNormal; }
                set { m_ImageNormal = value; this.Refresh(); }
            }
            [Description("image etat cliquer")]
            public Image ImageClick
            {
                get { return m_ImageClick; }
                set { m_ImageClick = value; this.Refresh(); }
            }
            [Description("image etat mouse over")]
            public Image ImageOver
            {
                get { return m_ImageOver; }
                set { m_ImageOver = value; this.Refresh(); }
            }
            [Description("image etat desactivé")]
            public Image ImageDisiable
            {
                get { return m_ImageDisiable; }
                set { m_ImageDisiable = value; this.Refresh(); }
            }
     
            private void UC_RichIcon_MouseUp(object sender, MouseEventArgs e)
            {
                if (Enable)
                {
                    StateButton = StateType.Over;
                    if (m_ImageOver != null)
                        this.BackgroundImage = m_ImageOver;
                }
            }
     
            private void UC_RichIcon_MouseDown(object sender, MouseEventArgs e)
            {
                if (Enable)
                {
                    StateButton = StateType.Clicked;
                    if(m_ImageClick !=null)
                        this.BackgroundImage = m_ImageClick;
                }
            }
     
            private void UC_RichIcon_MouseLeave(object sender, EventArgs e)
            {
                if (Enable)
                {
                    StateButton = StateType.Neutral;
                    if (m_ImageNormal != null)
                        this.BackgroundImage = m_ImageNormal;
                }
            }
     
            private void UC_RichIcon_MouseEnter(object sender, EventArgs e)
            {
                if (Enable)
                {
                    StateButton = StateType.Over;
                    if (m_ImageOver != null)
                        this.BackgroundImage = m_ImageOver;
                }
     
            }
     
        }
    }

  2. #2
    Modérateur
    Avatar de sevyc64
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Janvier 2007
    Messages
    10 193
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Pyrénées Atlantiques (Aquitaine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Janvier 2007
    Messages : 10 193
    Points : 28 077
    Points
    28 077
    Par défaut
    si tu parle d'afficher l'image, chez moi, ça marche. Les 4 images s'affichent bien suivant l'état du bouton
    --- Sevyc64 ---

    Parce que le partage est notre force, la connaissance sera notre victoire

Discussions similaires

  1. Imprimer etat bouton radio
    Par killerhertz dans le forum ASP
    Réponses: 1
    Dernier message: 04/09/2006, 23h50
  2. Etat bouton a bascule
    Par Alpha31 dans le forum Access
    Réponses: 2
    Dernier message: 02/06/2006, 23h41
  3. [FLASH 8] Etat dessus d'un bouton
    Par bractar dans le forum Flash
    Réponses: 3
    Dernier message: 09/03/2006, 16h57
  4. Réponses: 10
    Dernier message: 05/03/2006, 11h51
  5. wxWidgets : connaître l'etat d'un bouton !
    Par FSF_Sterl dans le forum wxWidgets
    Réponses: 5
    Dernier message: 14/08/2004, 08h55

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