public void LoadFile(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Bob Ros Simulator Format|*.brs|Image file|*.png;*.jpg;*.jpeg;*.gif;*.ico;*.bmp;*.tiff;*.wmf|PNG image|*.png|JPG/JPEG image|*.jpeg|Bitmap image|*.BMP|Jif image|*.gif|Tiff image|*.tiff|Icon File|*.ico"; if (dialog.ShowDialog() == DialogResult.OK) { if (Path.GetExtension(dialog.FileName).ToLower() == ".brs") { string[] text = File.ReadAllLines(dialog.FileName); schetscontrol.SetDrawnShapes(DecodeBRSText(text)); schetscontrol.drawShapes(); } else { //Read image file to buffer schetscontrol.Schoon(this, null); schetscontrol.Schets.bitmap = (Bitmap)Image.FromFile(dialog.FileName); //Padding for controls (+70) Size sz = new Size(schetscontrol.Schets.bitmap.Width + 70 + rightPanel.Size.Width, schetscontrol.Schets.bitmap.Height + 50); if (sz.Width < minSize.Width) { sz.Width = minSize.Width; } if (sz.Height < minSize.Height) { sz.Height = minSize.Height; } this.veranderAfmeting(sz); schetscontrol.Invalidate(); } changed = false; } }