public ImageCard(string id, string uri, string title, string ambientes, int stars) { InitializeComponent(); label1.Text = title; label2.Text = ambientes; byte[] imageBytes = Convert.FromBase64String(uri); MemoryStream memoryStream = new MemoryStream(imageBytes); pictureBox1.InitialImage = null; pictureBox1.Image = Image.FromStream(memoryStream); List <star> starsList = new List <star>(); for (int i = 0; i < stars; i++) { star s = new star(); s.BackColor = Color.WhiteSmoke; starsList.Add(s); } flowLayoutPanel1.AutoScroll = true; flowLayoutPanel1.FlowDirection = FlowDirection.LeftToRight; flowLayoutPanel1.WrapContents = false; foreach (Control control in starsList) { flowLayoutPanel1.Controls.Add(control); } this.id = id; }
public Comentario(Entities.Comentario comentario) { InitializeComponent(); this.id = comentario.Id; descripcion.Text = comentario.Value; List <star> starsList = new List <star>(); for (int i = 0; i < comentario.Calificacion; i++) { star s = new star(); s.BackColor = Color.White; starsList.Add(s); } flowLayoutPanel1.AutoScroll = true; flowLayoutPanel1.FlowDirection = FlowDirection.LeftToRight; flowLayoutPanel1.WrapContents = false; foreach (Control control in starsList) { flowLayoutPanel1.Controls.Add(control); } }
public inmuebleView(string _id) { InitializeComponent(); try { Services.Inmueble _inmueble = new Services.Inmueble(); this.inmueble = _inmueble.TraerInmueble(_id); byte[] byteBuffer = Convert.FromBase64String(inmueble.Uri); MemoryStream memoryStream = new MemoryStream(byteBuffer); Bitmap bitmap = new Bitmap(Bitmap.FromStream(memoryStream)); pictureBox2.Image = bitmap; pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage; titulo.Text = inmueble.Title; ubicacion.Text = inmueble.Ubication + " - " + inmueble.Address; descripcion.Text = inmueble.Description; List <star> starsList = new List <star>(); for (int i = 0; i < inmueble.Stars; i++) { star s = new star(); s.BackColor = Color.WhiteSmoke; starsList.Add(s); } flowLayoutPanel1.AutoScroll = true; flowLayoutPanel1.FlowDirection = FlowDirection.LeftToRight; flowLayoutPanel1.WrapContents = false; foreach (Control control in starsList) { flowLayoutPanel1.Controls.Add(control); } this._id = _id; } catch (Exception error) { MessageBox.Show(error.Message, "Error"); } }