Created
July 2, 2015 21:28
-
-
Save Fhernd/a5bb4e34abcb2e984e32 to your computer and use it in GitHub Desktop.
Control personalizado `SillaGrafica`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ===++=== | |
// | |
// OrtizOL - xCSw | |
// | |
// Proyecto: Cupi2.NET | |
// | |
// ===--=== | |
/*============================================================ | |
// | |
// Clase(s): ControlSillaGrafica. | |
// | |
// Propósito: Representar un control de silla gráfica. | |
// | |
// Original: http://cupi2.uniandes.edu.co/sitio/index.php/cursos/apo1/nivel-3/avion/visualizacion-codigo/sillagrafica | |
// | |
============================================================*/ | |
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Drawing; | |
using System.Data; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
using ElAvión.Modelo; | |
namespace ElAvión.GUI | |
{ | |
/// <summary> | |
/// Clase que representa el control personalizado de silla gráfica. | |
/// </summary> | |
public partial class ControlSillaGrafica : UserControl | |
{ | |
#region Propiedades | |
/// <summary> | |
/// Recupera y modifica el valor textual del número de una silla. | |
/// </summary> | |
public override string Text | |
{ | |
get | |
{ | |
return lblNumeroSilla.Text; | |
} | |
set | |
{ | |
lblNumeroSilla.Text = value; | |
} | |
} | |
#endregion | |
#region Constructores: | |
/// <summary> | |
/// Crea una nueva silla gráfica. | |
/// </summary> | |
/// <param name="silla">Silla con los datos a visualizar.</param> | |
public ControlSillaGrafica(Silla silla) | |
{ | |
InitializeComponent(); | |
Label lblSilla = new Label(); | |
if (silla.Clase == Clase.Ejecutiva && silla.SillaAsignada()) | |
{ | |
this.BackgroundImage = Properties.Resources.silla_ocupada; | |
} | |
else if (silla.Clase == Clase.Ejecutiva && !silla.SillaAsignada()) | |
{ | |
this.BackgroundImage = Properties.Resources.silla_libre_ejectutivo; | |
} | |
else if (silla.Clase == Clase.Economica && silla.SillaAsignada()) | |
{ | |
this.BackgroundImage = Properties.Resources.silla_ocupada; | |
} | |
else if( silla.Clase == Clase.Economica && !silla.SillaAsignada()) | |
{ | |
this.BackgroundImage = Properties.Resources.silla_libre_economica; | |
} | |
this.BackgroundImageLayout = ImageLayout.Center; | |
this.BackColor = Color.FromArgb(25, Color.White); | |
this.Size = this.BackgroundImage.Size; | |
Text = silla.Numero.ToString(); | |
lblNumeroSilla.ForeColor = Color.Black; | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment