private void comboBox_floor_plan_SelectedIndexChanged(object sender, EventArgs e) { floor_plan_selected = (floor_plan)comboBox_floor_plan.SelectedItem; platform_selected.set_floor_plan(floor_plan_selected); pictureBox_platform.Image = platform_selected.get_background_pic(); }
private void importToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Image Files(*.BMP;*.GIF;*.JPEG;*.PNG;)|*.BMP;*.GIF;*.JPG;*.JPEG;*.PNG;*.TIFF;*.TIF|All files (*.*)|*.*"; if (ofd.ShowDialog() == DialogResult.OK) { floor_plan fp = new floor_plan(); if (fp.new_floor_plan(ofd.FileName)) { paint_platform(); _list_floor_plan.Add(fp); comboBox_floor_plan.DataSource = null; comboBox_floor_plan.DataSource = _list_floor_plan; } else { MessageBox.Show("Error importing picture!", "ERROR"); } } }
/// <summary> /// lade bild aus datei und speichere diese für weitere verwendung /// </summary> /// <param name="path_to_pic">pfad zur bild datei</param> /// <returns></returns> //public bool set_background_pic(string path_to_pic) //{ // if (File.Exists(path_to_pic)) // { // try // { // Image tmp_img = Image.FromFile(path_to_pic); // _picture_heigth = tmp_img.Height; // _picture_width = tmp_img.Width; // MemoryStream ms = new MemoryStream(); // tmp_img.Save(ms, System.Drawing.Imaging.ImageFormat.Png); // _imageAsByteArray = ms.ToArray(); // return true; // } // catch (Exception e) { // log.exception(this, "set_background_pic() [" + path_to_pic + "]" , e); // } // } // else // log.msg(this, "call set_background_pic with none existing path"); // return false; //} public void set_floor_plan(floor_plan fp) { _floor_plan = fp; }