Advertisement
Fhernd

ControlSillaGrafica.cs

Jul 2nd, 2015
4,048
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.66 KB | None | 0 0
  1. // ===++===
  2. //
  3. //    OrtizOL - xCSw
  4. //
  5. //  Proyecto: Cupi2.NET
  6. //
  7. // ===--===
  8. /*============================================================
  9. //
  10. // Clase(s): ControlSillaGrafica.
  11. //
  12. // Propósito: Representar un control de silla gráfica.
  13. //
  14. // Original: http://cupi2.uniandes.edu.co/sitio/index.php/cursos/apo1/nivel-3/avion/visualizacion-codigo/sillagrafica
  15. //
  16. ============================================================*/
  17. using System;
  18. using System.Collections.Generic;
  19. using System.ComponentModel;
  20. using System.Drawing;
  21. using System.Data;
  22. using System.Linq;
  23. using System.Text;
  24. using System.Threading.Tasks;
  25. using System.Windows.Forms;
  26. using ElAvión.Modelo;
  27.  
  28. namespace ElAvión.GUI
  29. {
  30.     /// <summary>
  31.     /// Clase que representa el control personalizado de silla gráfica.
  32.     /// </summary>
  33.     public partial class ControlSillaGrafica : UserControl
  34.     {
  35.         #region Propiedades
  36.         /// <summary>
  37.         /// Recupera y modifica el valor textual del número de una silla.
  38.         /// </summary>
  39.         public override string Text
  40.         {
  41.             get
  42.             {
  43.                 return lblNumeroSilla.Text;
  44.             }
  45.             set
  46.             {
  47.                 lblNumeroSilla.Text = value;
  48.             }
  49.         }
  50.         #endregion
  51.  
  52.         #region Constructores:
  53.         /// <summary>
  54.         /// Crea una nueva silla gráfica.
  55.         /// </summary>
  56.         /// <param name="silla">Silla con los datos a visualizar.</param>
  57.         public ControlSillaGrafica(Silla silla)
  58.         {
  59.             InitializeComponent();
  60.  
  61.             Label lblSilla = new Label();
  62.  
  63.             if (silla.Clase == Clase.Ejecutiva && silla.SillaAsignada())
  64.             {
  65.                 this.BackgroundImage = Properties.Resources.silla_ocupada;
  66.             }
  67.             else if (silla.Clase == Clase.Ejecutiva && !silla.SillaAsignada())
  68.             {
  69.                 this.BackgroundImage = Properties.Resources.silla_libre_ejectutivo;
  70.             }
  71.             else if (silla.Clase == Clase.Economica && silla.SillaAsignada())
  72.             {
  73.                 this.BackgroundImage = Properties.Resources.silla_ocupada;
  74.             }
  75.             else if( silla.Clase == Clase.Economica && !silla.SillaAsignada())
  76.             {
  77.                 this.BackgroundImage = Properties.Resources.silla_libre_economica;
  78.             }
  79.  
  80.             this.BackgroundImageLayout = ImageLayout.Center;
  81.             this.BackColor = Color.FromArgb(25, Color.White);
  82.             this.Size = this.BackgroundImage.Size;
  83.  
  84.             Text = silla.Numero.ToString();
  85.             lblNumeroSilla.ForeColor = Color.Black;
  86.         }
  87.         #endregion
  88.     }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement